Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » "updatable = false" column getting updated
"updatable = false" column getting updated [message #910134] Sat, 08 September 2012 19:41 Go to next message
Savvas Andreas Moysidis is currently offline Savvas Andreas MoysidisFriend
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 10:32 Go to previous messageGo to next message
Lars Drießnack is currently offline Lars DrießnackFriend
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 10:33]

Report message to a moderator

Re: "updatable = false" column getting updated [message #911349 is a reply to message #911310] Tue, 11 September 2012 12:31 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

This may have been fixed in later versions. Try the latest release.

In 2.0 you may have required to set insertable and updateable to false to avoid the column being persisted.


James : Wiki : Book : Blog : Twitter
Re: "updatable = false" column getting updated [message #915211 is a reply to message #911349] Sun, 16 September 2012 20:43 Go to previous message
Savvas Andreas Moysidis is currently offline Savvas Andreas MoysidisFriend
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
Previous Topic:Mysterious double insert (SOLVED, see reply)
Next Topic:EclipseLink-48
Goto Forum:
  


Current Time: Wed Nov 26 23:21:16 GMT 2014

Powered by FUDForum. Page generated in 0.01734 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software