hibernate - How do I calculate the anniversary date in JPQL -


i'm using jpa2

i have queried in ms access in following way

for example, find out anniversary in 2 years:

select dateadd(year, 2, initialdate) anniv 

or find out how many years have passed since initial date:

select datediff(year, initialdate, getdate()) yearspassed 

i'm not able find function in dateadd in jpql

could 1 please me getting similar effect in jpql

hibernate session provides dowork() method gives direct access java.sql.connection. can create , use java.sql.callablestatement execute function.

here oracledb function example:

session.dowork(new work() {   public void execute(connection connection) throws sqlexception {     callablestatement call = connection.preparecall("{ ? = call myschema.myfunc(?,?) }");     call.registeroutparameter( 1, types.integer ); // or whatever     call.setlong(2, id);     call.setlong(3, transid);     call.execute();     int result = call.getint(1); // propagate enclosing class   } }); 

or calculate within programm logic.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -