Skip to main content



      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 00:57 Go to next message
Eclipse UserFriend
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 03:11 Go to previous messageGo to next message
Eclipse UserFriend
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 03:12 Go to previous message
Eclipse UserFriend
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: Tue Jul 15 09:11:32 EDT 2025

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

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

Back to the top