Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: Re[eclipselink-users] adOnly embedded primary key ?

It should be possible using the updateable/insertable=false.  Perhaps include
your code, and the exception and stack trace.



xcallejas wrote:
> 
> 
> Hi,
> 
> Can I have a embedded primary key just for read only? I need to have the 
> fields of the composite primarity to be written in the entity not in the 
> primary key.
> 
> Why? because I need to know (without query to the database) if the entity
> is a 
> new entity (primary key instace is null) or if it exist in the database 
> already.
> 
> I have updatable = false, insertable = false in the fields of the primary
> key 
> embedded class, I have also declared the class as @ReadOnly, but when I
> try to 
> persist the entity it says that the field "ClientID" (part of the
> composite 
> primary key) cannot be NULL, but it is not null in the "Client" field in
> the 
> entity instance.
> 
> Thanks in advance.
> xavier.
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/ReadOnly-embedded-primary-key---tp25810402p25892313.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top