Skip to main content

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

Impossible. Insert into primary table always followed by insert into the secondary one.

On 8/12/2011 4:20 PM, 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