| Dynamic updateble attribute [message #649486] |
Wed, 19 January 2011 07:54  |
Radu Messages: 12 Registered: August 2010 |
Junior Member |
|
|
Hi all,
I'm trying to define field level security using eclipselink in JPA 2 environment (Glassfish 3.1 b37, eclipselink 2.2.0-M6).
I'm using the following code to get field definition.
JpaEntityManager elEm = (JpaEntityManager) em.getDelegate();
ClassDescriptor entityDescriptor = elEm.getActiveSession().getDescriptor(entityObject);
DatabaseField fieldDefinition = entityDescriptor.getMappingForAttributeName("testUpdatedField ").getField();
boolean fieldIsUpdatable = fieldDefinition.isUpdatable();
How can the field be excluded from the SQL UPDATE?
fieldDefinition.setUpdatable(false);
doesn't work.
Thanks!
|
|
|
|
|
| Re: Dynamic updateble attribute [message #649772 is a reply to message #649486] |
Thu, 20 January 2011 09:56  |
James Sutherland Messages: 1844 Registered: July 2009 |
Senior Member |
|
|
You could try using the aboutToUpdate event to remove the fields from the update row.
I may be best to have two different classes mapped to the table and use one versus the other in the application based on the role. i.e. UnscureEmployee and SecureEmployee. They could share a common @MappedSuperclass for the unsecure data.
James : Wiki : Book : Blog
|
|
|
Powered by
FUDForum. Page generated in 0.01892 seconds