ReadOnly embedded primary key ?

View: New views
2 Messages — Rating Filter:   Alert me  

ReadOnly embedded primary key ?

by xcallejas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@...
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

Re: ReadOnly embedded primary key ?

by James Sutherland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.