Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] How to retrieve a non database field and not having it persistent

This is not something JPA directly supports.  Some possibilities are:
- Map it as transient, and lazy initialize it from the database when first
accessed.
- Map is using a @TransformationMapping
- If you can get it retrieved (are you calling the column name "SYSDATE"?),
then mark the @Column insertable=false, updatable=false to avoid writing it.
- Use a "new Date()" in Java instead.


SPHQ wrote:
> 
> Using eclipselink and oracle - For example, I want to execute
> Select sysdate from dual and store the result in an attribute ( say X ) of
> a class
> and the attribute not being a field in the table.
> If I use @Transient , the value is not retrieved. 
> If I do not use @transient, the value is retrieved  but when I try to
> persist,
> it says 'unknow identifier'. Can somebody help ?
> 


-----
---
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 
-- 
View this message in context: http://www.nabble.com/How-to-retrieve-a-non-database-field-and-not-having-it-persistent-tp21046339p21052438.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top