openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Igor Fedorenko <igor...@yahoo.com>
Subject Re: @IdClass annotation for id field of type byte[]
Date Wed, 03 Jan 2007 00:23:43 GMT
You can use use RAW(16) to store GUIDs in Oracle. This datatype is 
allowed in primary keys.

--
Regards,
Igor

Dain Sundstrom wrote:
> 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