This section contains a few unorganized tips on Object/Relational modeling in Cayenne. Some of these tips may become obsolete in the future as the Modeler evolves, making many things more transparent to the user.

  • Pay attention to validation messages when saving the project, this helps preventing lots of runtime errors. Click on the error message to go to the problem spot.
  • All DbRelationships must have reverse relationships.
  • TO-ONE ObjRelationships do not require reverse relationships to work, but TO-MANY currently do.
  • Do not map meaningless primary key DbAttributes (like autogenerated sequential numbers) to ObjAttributes. Simply exclude them from the object model, Cayenne will do the right thing for you.
  • Do not forget that even if you work with an existing database schema, special database objects may need to be created to support automated primary key generation.
  • Display order of attributes and relationships is alphabetic and does not affect Cayenne runtime behavior.
  • Display order of Procedure Parameters is important - this is the order in which stored procedure parameters will be bound. Use "Up" and "Down" buttons in the bottom of the "Parameters" tab to change parameter position.