P. 1
Hibernate Entity Manager

Hibernate Entity Manager

|Views: 565|Likes:
Publicado porVijay

More info:

Published by: Vijay on Mar 24, 2010
Direitos Autorais:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

10/25/2011

pdf

text

original

You may also define named queries through annotations:

@javax.persistence.NamedQuery(name="eg.DomesticCat.by.name.and.minimum.weight",
query="select cat from eg.DomesticCat as cat where cat.name = ?1 and cat.weight > ?2")

Parameters are bound programatically to the named query, before it is executed:

Query q = em.createNamedQuery("eg.DomesticCat.by.name.and.minimum.weight");
q.setString(1, name);
q.setInt(2, minWeight);
List cats = q.getResultList();

Note that the actual program code is independent of the query language that is used, you may also define native
SQL queries in metadata, or use Hibernate's native facilities by placing them in XML mapping files.

You're Reading a Free Preview

Descarregar
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->