| "updatable = false" column getting updated [message #910134] |
Sat, 08 September 2012 15:41  |
Savvas Andreas Moysidis Messages: 2 Registered: September 2012 |
Junior Member |
|
|
Hello,
I am using EclipseLink version 2.0.0 (downloaded the jar file directly from the eclipse website since it wasn't present in the main Maven repo).
I have a property defined as follows:
@Column(name = "_username", nullable = false, updatable = false)
private String username;
Now, if I "find" an existing Entity and set its username property to something else that Entity is updated with this new value in the database. My understanding was that if a column is defined with "updatable = false" then this column is excluded from the update statement?
What am I missing?
Cheers,
Savvas
|
|
|
| Re: "updatable = false" column getting updated [message #911310 is a reply to message #910134] |
Tue, 11 September 2012 06:32   |
Lars Drießnack Messages: 9 Registered: August 2012 |
Junior Member |
|
|
Hi,
which DB do you use?
I suggest to have a look into the constraints of the table directly on your DB and check if the constraint is really available and active.
The query should look like this:
SELECT * FROM [constraint table name] uc WHERE uc.table_name = '[user table name]'
With this small code fragment it is hard to say what your problem is.
Lars
[Updated on: Tue, 11 September 2012 06:33] Report message to a moderator
|
|
|
|
| Re: "updatable = false" column getting updated [message #915211 is a reply to message #911349] |
Sun, 16 September 2012 16:43  |
Savvas Andreas Moysidis Messages: 2 Registered: September 2012 |
Junior Member |
|
|
Hi,
Thanks very much for your replies.
I will give a later version a try and see if that fixes the problem. For the record, specifying both attributes (insertable/updatable) to "false" causes some odd problems..the unit test I'm running throws a somewhat cryptic "Database Error" exception with no more information of what went wrong...
I am using a MySql database and will dig into its constraints table to see what it has been configured with but I was under the impression that this constraint was being enforced at the JPA layer (meaning the non-updatable column is excluded from the generated update DML statement).
Thanks very much again.
Savvas
|
|
|
Powered by
FUDForum. Page generated in 0.02069 seconds