[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] SecondaryTable question
|
We use JPQL to load the Registration objects. Is it possible to invoke a stored procedure along with a JPQL?
Sri
-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Tom Ware
Sent: Monday, August 15, 2011 9:15 AM
To: EclipseLink User Discussions
Subject: Re: [eclipselink-users] SecondaryTable question
Is callilng the Stored Procedure directly an option?
Sri Sankaran wrote:
> No, it doesn't HAVE TO BE a secondaryTable. Actually the attempt at
> using a secondaryTable was admittedly a hack that didn't pan out :-P
>
> Here's the scenario. Maybe you can suggest the appropriate approach.
>
> The table REGISTRATIONS contains a column called EXPIRATION_DATE.
> Now, based on the current date and myriad business rules I must
> communicate an expiration STATUS to the user. This has been
> implemented as a stored procedure. The stored procedure is invoked by
> accessing the view REGISTRATION_STATUS_FLAGS_V. Ergo wiring the
> Registration class to use this view as a secondary table.
>
> Note that I cannot pre-calculate the expiration status. Since its
> calculation is time sensitive it must be done in real time, i.e. when
> the user issues the request.
>
> Any better way come to mind?
>
> Sri
>
> -----Original Message-----
> From: eclipselink-users-bounces@xxxxxxxxxxx
> [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Tom Ware
> Sent: Monday, August 15, 2011 7:53 AM
> To: EclipseLink User Discussions
> Subject: 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/Seconda
>> r yTable.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 <mailto:eclipselink-users@xxxxxxxxxxx>
>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
>
>
>
> ----------------------------------------------------------------------
> --
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users