1) Could we use non-mapped variables in an Enity Object(which uses JPA annotations)
2) Is there way we could use the Annotation mapping and Call to a Stored procedures in the same entity class?
3) Here is one more scenario
Table mapped to the below two
->-->@OneToOne TEST_TABLE1 on TEST_TABLE1_ID->>@OneToOne TEST_TABLE3 on TEST_TABLE3_ID
->--->@OneToOne TEST_TABLE2 on TEST_TABLE2_ID->>@OneToOne TEST_TABLE4 on TEST_TABLE4_ID
Now there is a condition: TEST_TABLE3, TEST_TABLE4 hava a column VALUE. And I want all values were TEST_TABLE3.VALUE==TEST_TABLE4.VALUE.
How do I do that? IS there a way to efficiently perform and implement the above three scenarios?
I am moving from EJB to spring, some legacy code has tedious SQLs (which call stored procedures), using JPA I have succesfully replace the SQL but was unable to substitute the procedure calls made by the legacy SQL, hence was exploring options on that. (I did not post the actual Tables names or package names , hence replaced it with dummy or generic names in my post.)
Use @Transient (or transient) to mark non-persisted fields.
You could map to a view instead of a table that call the stored procedure. Or mark it @Transient and set it in your app, or get method.
JPA requires relationship to be by Id, but some JPA providers support more complex relationships. In EclipseLink you can define a relationship using an Expression, or custom SQL or a StoredProcedureCall.
Now I am faced with another issue;
I am planning to utilize ehCache for secondary level caching,
and since I am using Hibernate+JPA and there will be entity classes with Transient variables, is there any way i could save thae transient variable information in the secondary level cache?