Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Unable to set an attribute as primary key
Unable to set an attribute as primary key [message #1754181] Wed, 15 February 2017 05:57 Go to next message
lucky lucky is currently offline lucky luckyFriend
Messages: 1
Registered: February 2017
Junior Member
We are developing an application using EMF/CDO.
We are facing one issue.
We are trying to make "student_id" attribute in the Student class as primary key. For this we set the unique property
and the ID property of the attribute of Student class in the model , but we are still able to insert duplicate records.
We check at the database level. The corrosponding Student table has primary key which is cdo_id and cdo_version
but not the student_id of the table.
Please let us know how to solve the problem.
We have attached .Ecore file and the java code for running CDO server and java code for saving data .
We are using PostgreSQL 9.3.5
The CDO version is 4.5.0.
Re: Unable to set an attribute as primary key [message #1754284 is a reply to message #1754181] Thu, 16 February 2017 08:11 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
You can't change the PK with CDO.

With CDO 4.6 integration builds you can add additional indexes by specifying "http://www.eclipse.org/CDO/DBIndex" annotations in your model, but they're non-unique.

You could hook a WriteAccessHandler into your repository and validate incoming commits, see IRepository.addHandler() and IRepository.WriteAccessHandler.handleTransactionBeforeCommitting().


Re: Unable to set an attribute as primary key [message #1754285 is a reply to message #1754284] Thu, 16 February 2017 08:12 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Please prefix your CDO-specific questions with [CDO] to make sure you get prompt replies.

Previous Topic:Effect of the load options?
Next Topic:Very high loading times of models with ID feature
Goto Forum:
  


Current Time: Fri Mar 29 15:00:46 GMT 2024

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

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

Back to the top