openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@bea.com>
Subject RE: @IdClass annotation for id field of type byte[]
Date Wed, 03 Jan 2007 01:10:51 GMT
You could do this with an @Externalizer that converts the byte[] into a
long or a string or what have you, and a @Factory that reverses it.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Dain Sundstrom [mailto:dain@iq80.com] 
> Sent: Tuesday, January 02, 2007 4:02 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: Re: @IdClass annotation for id field of type byte[]
> 
> Can you have java field of type byte[] that maps to a NUMERIC (or  
> heck a varchar) in he db?  I'm guessing that Kevin's guid is a fixed  
> 128 bit number.  If it is and he can map it to a non-blob type, it  
> should be possible to join with any database system.
> 
> -dain
> 
> On Jan 2, 2007, at 3:09 PM, Marc Prud'hommeaux wrote:
> 
> > Kevin-
> >
> >> Also, this exception is supposedly only being produced with  
> >> Oracle, not
> >> DB2.  (I have not been able to verify that yet.)  This 
> would seem to
> >> indicate that it's dictionary-specific, but I'm not seeing  
> >> anything there
> >> yet...
> >
> > Does Oracle even support blob primary keys? My recollection 
> is that  
> > it didn't...
> >
> > I suspect that the problem might be that since Oracle has a number  
> > of problems with in-line blobs in statements, we frequently 
> issue a  
> > separate statement to load and store blobs from and to 
> rows, but if  
> > it is the primary key, then we might be conflicting with that. Can  
> > you post the complete stack trace?
> >
> >
> >
> >
> > On Jan 2, 2007, at 6:03 PM, Kevin Sutter wrote:
> >
> >> Hi,
> >> Some experimenting with the @IdClass support is producing a strange
> >> exception message when attempting to map an id field of 
> type byte[].
> >> According to the OpenJPA documentation, we need to use an 
> Identity  
> >> Class to
> >> use byte[] as the id field type.  Something like this:
> >>
> >> @Entity
> >> @IdClass (jpa.classes.Guid.class)
> >> @Table(name="AGENT", schema="CDB")
> >> public class Agent {
> >>
> >>    @Id
> >>    @Column(name="ME_GUID")
> >>    private byte[] guid;
> >> ...
> >>
> >> The Guid class has also been created with a single instance  
> >> variable of type
> >> byte[]:
> >>
> >> public class Guid implements Serializable {
> >>    private byte[] guid;
> >> ...
> >>
> >> But, during the loading of the database, I am getting the  
> >> following error...
> >>
> >> org.apache.openjpa.util.MetaDataException: You cannot join on  
> >> column "
> >> AGENT.ME_GUID".  It is not managed by a mapping that supports joins
> >>
> >> First off, the exception is confusing since I don't believe I am  
> >> attempting
> >> to do a join.  The guid column is in the same table as the Agent.
> >>
> >> Also, this exception is supposedly only being produced with  
> >> Oracle, not
> >> DB2.  (I have not been able to verify that yet.)  This 
> would seem to
> >> indicate that it's dictionary-specific, but I'm not seeing  
> >> anything there
> >> yet...
> >>
> >> I am in the process of validating the problem, but I thought I  
> >> would drop a
> >> line to the team to see if it rings any bells...
> >>
> >> Thanks,
> >> Kevin
> 
> 

Mime
View raw message