Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Deadlock or ignored id-validation - I've trouble

Sequencing has nothing to do with shared cache mode, should work with any mode.

By default id validation is set to ZERO for simple primary key and NULL for compound primary key.

If you set id validation to NULL for a simple primary key, then all the values except NULL will be accepted as a legitimate pk value and won't be overridden by sequencing.

For example:
public class Employee {
@Id
@GeneratedValue(strategy=TABLE, generator="EMPLOYEE_TABLE_GENERATOR")
@TableGenerator(
    name="EMPLOYEE_TABLE_GENERATOR",
    pkColumnValue="EMPLOYEE_SEQ",
)
int id
...
}

When an Employee object is persisted and it's id=0, if id validation is ZERO, then sequencing fetches a value from sequence table that's assigned to the Employee.

However with id validation set to null:
@PrimaryKey(validation=IdValidation.NULL)
public class Employee {
...
}
the Employee object is inserted in the db with id=0.

If this doesn't help please explain what are you trying to do,
may be provide a simple example.

Thanks,
Andrei

On 5/31/2013 10:19 AM, Edson Richter wrote:
Dear friends,

If I enable

     <shared-cache-mode>ALL</shared-cache-mode>

Then I get id-validation = "NULL" working properly. But then, I get
deadlock when multiple users are depending on same sequence (TABLE based
sequencing).

If I put

     <shared-cache-mode>ALL</shared-cache-mode>

Then I get a lot of errors that my objects has id = null, and I must
enable "eclipselink.id-validation" (which is already enabled).


I don't know which is worse: deadlock or processing errors... Can anyone
help?

Thanks,

Edson

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top