Hi Werner,

I just talked to my old colleague Henk van Voorthuijsen en he told me that
he made this piece of code together with you for a workaround for the
getIdentity

 public Object getIdentity(final Object data) throws MappingException
  {

    AbstractConnectionFactory cf =
DatabaseRegistry.getConnectionFactory(getDatabase().getDatabaseName());
    MappingResolver mappRes = cf.getMapping().getResolver(Mapping.JDO);

    ClassDescriptor clsDesc = mappRes.getDescriptor(data.getClass());
    FieldDescriptor[] identities = ((ClassDescriptorImpl)
clsDesc).getIdentities();
    if ((identities != null) && (identities.length > 0))
    {
        Object[] values = new Object[identities.length];
        for (int i = 0; i < identities.length; i++)
        {
            values[i] = identities[i].getHandler().getValue(data);
            if (values[i] instanceof BigDecimal)
            {
                if (identities[i].getFieldType() == Integer.class)
                {
                    values[i] = new Integer(((BigDecimal)
values[i]).intValue());
                }
                if (identities[i].getFieldType() == Long.class)
                {
                    values[i] = new Long(((BigDecimal)
values[i]).longValue());
                }
            }
        }
        return (identities.length == 1
                ? values[0]
                : new Complex(values));
    }
    return null;
}
Met vriendelijke groet/with kind regards,


Ad Kerremans
Technical Consultant

Serac Applications BV
Postbus 83
3454 ZH De Meern

BEZOEKADRES;
Rijnzathe 36
3454 PV De Meern

Direct: +31 (0)30 658 33 35
Algemeen: +31 (0)30 - 658 33 33
Fax: +31 (0)30 - 658 33 66
Helpdesk: +31 (0)30 - 658 33 99

Website: http://www.serac.nl




                                                                                
                                                                      
                      [EMAIL PROTECTED]                                         
                                                                      
                      c.nl                     To:       
[email protected]                                                        
             
                                               cc:                              
                                                                      
                      15-11-2006 13:39         Subject:  RE: [castor-user] 
problems upgrading to castor 1.0.5 from 1.0                                
                      Please respond to                                         
                                                                      
                      user                                                      
                                                                      
                                                                                
                                                                      





Hi Werner,


I don't know why these classes are used this is an old piece of code. The
person that did write this code is no longer working here.

Met vriendelijke groet/with kind regards,


Ad Kerremans





                      "Werner Guttmann"

                      <[EMAIL PROTECTED]        To:
<[email protected]>

                      com>                     cc:

                                               Subject:  RE: [castor-user]
problems upgrading to castor 1.0.5 from 1.0
                      15-11-2006 13:21

                      Please respond to

                      user






As far as I know, some of these classes have been refactroed recently.
But let's wait to see what Ralf has got to sa. Having said that, I'd be
interested to learn what you are trying to achieve by using that code.
In other words, I would not expect that a user of Castor JDO would try
to use these classes.

Werner

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Mittwoch, 15. November 2006 13:14
> To: [email protected]
> Subject: [castor-user] problems upgrading to castor 1.0.5 from 1.0
>
> Hi,
>
> I replaced the Castor 1.0 jar with the 1.0.5 jar.
> My project is complaining that the classess MappingResolver
> and Mapping.JDO cannot be resolved
>
> my imports are:
>
> import org.castor.jdo.engine.AbstractConnectionFactory;
> import org.castor.jdo.engine.DatabaseRegistry;
> import org.exolab.castor.jdo.*;
> import org.exolab.castor.mapping.*;
> import org.exolab.castor.mapping.loader.ClassDescriptorImpl;
> import org.exolab.castor.persist.spi.Complex;
>
> Piece of my code:
>
> AbstractConnectionFactory cf =
> DatabaseRegistry.getConnectionFactory(getDatabase().getDatabas
> eName());
> MappingResolver mappRes = cf.getMapping().getResolver(Mapping.JDO);
>
>
> Met vriendelijke groet/with kind regards,
>
>
> Ad Kerremans
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email






---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email






---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to