Skip to main content

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

Right.  That's what we were doing. In addition we had identified the view (one column) as a SecondaryTable.  That's where we ran into rough weather.

Sri

-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of James Sutherland
Sent: Thursday, September 01, 2011 9:25 AM
To: eclipselink-users@xxxxxxxxxxx
Subject: Re: [eclipselink-users] SecondaryTable question


You could create a view that includes the table and view data and map to the view instead.  As long as the computed field is read-only (not insertable or
updateable) then it will not be included in inserts/updates.


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/Sec
> ondaryTable.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)
> public 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
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , http://wiki.oracle.com/page/TopLink TopLink
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , http://www.nabble.com/EclipseLink-f26430.html EclipseLink
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
Blog:  http://java-persistence-performance.blogspot.com/ Java Persistence Performance
--
View this message in context: http://old.nabble.com/SecondaryTable-question-tp32253203p32379568.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.

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




Back to the top