-
1. Re: How to call the Store procedure in jboss seam application
raphaufrj Jul 25, 2010 11:54 AM (in response to palani.palanivelsway.gmail.com)If you're using JPA with Jboss Seam will be:
String sup_name ="Tortuga Trading"; BigDecimal sum = (BigDecimal)em.createNativeQuery("SELECT sum_total(?1) FROM DUAL") .setParameter(1, sup_name) .getSingleResult(); out.println("The total cost of the ordered products supplied by Tortuga Trading: " + sum +"<br/>");
Regards,
-
2. Re: How to call the Store procedure in jboss seam application
serkan.s.eskici.online.nl Jul 26, 2010 12:20 PM (in response to palani.palanivelsway.gmail.com)You should make a Google search on Hibernate/JPA + Stored Procedure.
-
3. Re: How to call the Store procedure in jboss seam application
mauihoosier Jul 26, 2010 6:55 PM (in response to palani.palanivelsway.gmail.com)Insightful and incredibly helpful. Always good to know there are people out there who truly cherish helping the fellow man.
-
4. Re: How to call the Store procedure in jboss seam application
mauihoosier Jul 26, 2010 7:01 PM (in response to palani.palanivelsway.gmail.com)Palani - here is an example that I have used:
'
Query query = entityManager.createNamedQuery(pkgname.fnname
);
query.setParameter(param1
, param1);
bean = (Bean) query.getSingleResult();'The
Bean
is annotated like :'@Entity
@NamedNativeQuery(name =pkgname.fnname
, resultSetMapping =results
, query ={? = call SCHEMANAME.pkgname.fnname(:param1)}
, hints = {
@QueryHint(name =org.hibernate.callable
, value =true
),
@QueryHint(name =org.hibernate.readOnly
, value =true
) })
@SqlResultSetMapping(name =results
, entities = { @EntityResult(entityClass = BeanName.class) })'
-
5. Re: How to call the Store procedure in jboss seam application
moyphus Jul 30, 2010 6:47 AM (in response to palani.palanivelsway.gmail.com)@NamedNativeQuery(name="storedProc", query="sp_get_department_utility(:param1, :param2)", hints={ @QueryHint(value = "true", name="org.hibernate.callable"), @QueryHint(value = "true", name="org.hibernate.readOnly")}) @SqlResultSetMapping(name="resul", entities={ @EntityResult(entityClass = SysDepartments.class), @EntityResult(entityClass = Employee.class), @EntityResult(entityClass = ProductOrderLimitation.class), @EntityResult(entityClass = ProductOrderLimitation.class), @EntityResult(entityClass = ProductMaster.class)})
Query q=(Query) this.getEntityManager().createNamedQuery("storedProc") .setParameter(":category", ParamUtil.getCategory()) .setParameter(":clientId", LoginUserInfo.getClientId()); int list = q.executeUpdate();
It returns named query not found