On Mon, Jul 28, 2008 at 8:08 AM, Gaurav Malhotra
<gaurav.malhotra@...> 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@... > https://dev.eclipse.org/mailman/listinfo/eclipselink-users >