java - How do I use a stored procedure in h2 database while using junit? -
i have junit class file in turn calls dao class , creates stored procedure through entitymanager interface in dao class this:
@persistencecontext(unitname = "webapplication2pu") private entitymanager entitymanager; // entitmanager.createnamedstoredprocedurequery("next_prime") in method
the next_prime procedure finds next prime provided number. procedure specified in entity bean class.
as have read h2 database not support stored procedure , instead have create java class, providing sql file database in junit class in runscript as: jdbc:h2:~/test;init=runscript mysql.sql
this sql file contains stored procedure as:
create alias next_prime $$ string nextprime(string value) { return new biginteger(value).nextprobableprime().tostring(); } $$;
i want override procedure specified in dao class use 1 providing in sql file.
how achieve this? or doing wrong, please suggest.
Comments
Post a Comment