[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [eclipselink-users] org.hibernate.criterion.Example equivalent in Eclipselink
|
- From: "Tim Hollosy" <hollosyt@xxxxxxxxx>
- Date: Mon, 28 Jul 2008 08:11:41 -0400
- Delivered-to: eclipselink-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=HnzGntHFzDoguRuvkLeRytRKvC1j7KfdZbq0hgIhjOY=; b=M8zo/bZUF3lPTCqy99fjv6b7RUNez7wpg/pJ1L8DEyIn31zdm26tJNINhaMxs0msUQ fAy0pUOn02E9pgo83yJgX9h3QfJn/4hvVBGPxyskkCsl6JkQvihJz7crsSDY6NXkCIt6 +KTwbaX7PHBxzVlQsbAyARllMIHmd3lxsJoSY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=f2WF7WkS7jLdIN249zPKlVFuD/8IeBu3MFqkUerpWRdoMNIXXtVlQ/Z6pDrBBac08M 7CfWLMM44zw7W+clIRhQUckrW0IEvZxvhIcG9XAmWARcnJ+9L0u5svN+d1ykkahv01e2 d8KvcjhDpaDXYRj01acN4i2I2QXKL1FpXcwQA=
I believe the equivalent would be Expressions:
http://wiki.eclipse.org/Introduction_to_EclipseLink_Expressions_(ELUG)
./tch
On Mon, Jul 28, 2008 at 8:08 AM, Gaurav Malhotra
<gaurav.malhotra@xxxxxxxxxx> wrote:
>
> In Hibernate I use to write the following generic code and utilize
> hibernates org.hibernate.criterion.Example.
>
> http://www.hibernate.org/hib_docs/v3/api/org/hibernate/criterion/Example.html
>
> public List<T> findByExample(T exampleCriteria) {
> final T t = exampleCriteria;
> List<T> list = (List<T>) getJpaTemplate().execute(new JpaCallback() {
> public Object doInJpa(javax.persistence.EntityManager em)
> throws javax.persistence.PersistenceException {
> final Example example = Example.create(t).excludeZeroes();
>
> Criteria criteria = ((Session) em.getDelegate())
> .createCriteria(t.getClass()).add(example)
> .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
>
> return criteria.list();
> }
> });
> return list;
> }
>
> Whats an equivalent in EclipseLink??
> --
> View this message in context: http://www.nabble.com/org.hibernate.criterion.Example-equivalent-in-Eclipselink-tp18688959p18688959.html
> Sent from the EclipseLink - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>