Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] SecondaryTable question

Is there any particular reason this has to be a secondary table? Could this instead be mapped with some other mapping like a 1-1 - you could even provide methods on the class to make the values in the 1-1 accessible as if they were mapped on the same class.

-Tom

Sri Sankaran wrote:
Eclipselink version: 2.0.0
Is it possible to use a _secondary table_ <http://www.eclipse.org/eclipselink/api/2.0/javax/persistence/SecondaryTable.html> in such a way that inserts/updates happen only to the /primary /table? You are probably wondering “Why on earth would you want that behavior”. Here’s why. We are using the @SecondaryTable annotation to point to a view which contains read-only data. /@Table(//name=”REGISTRATIONS”)/
/@SecondaryTable(name=”REGISTRATION_STATUS_FLAGS_V)/
*p**ublic* *class* Registration {
  ...
  /@Column(name=”EXPIRATION_STATUS” /
/          table=”REGISTRATION_STATUS_FLAGS_V”/
/          insertable=”false”/
/          updatable=”false”)/
  private String expirationStatus;
}
The current setup is resulting in database errors because an insert to the primary table results in an attempted insert to the secondary table as well. Sri

------------------------------------------------------------------------

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


Back to the top