[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] org.hibernate.criterion.Example equivalent in Eclipselink

The link was missing the last ")",

http://wiki.eclipse.org/Introduction_to_EclipseLink_Expressions_(ELUG)
http://wiki.eclipse.org/Introduction_to_EclipseLink_Expressions_(ELUG) 

Expressions and possibly QueryByExample sounds what you are looking for.


Gaurav Malhotra wrote:
> 
> I get the following messgae when I click on the link 
> http://wiki.eclipse.org/Introduction_to_EclipseLink_Expressions_(ELUG)
> http://wiki.eclipse.org/Introduction_to_EclipseLink_Expressions_(ELUG) 
> 
> 
> There is currently no text in this page, you can search for this page
> title in other pages or edit this page.
> 
> 
> 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?? 
>> 
> 
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/org.hibernate.criterion.Example-equivalent-in-Eclipselink-tp18688959p18689204.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.