-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Begineer question.
PostPosted: Fri Apr 10, 2009 1:00 pm 
Newbie

Joined: Fri Apr 10, 2009 11:44 am
Posts: 2
I want to obtain a complete list of items matching a class i pass to a function as
an argument

public List<Campaign> getAllCampaignsEq( Campaign campaign )
{
//DetachedCriteria crit = DetachedCriteria.forClass( Campaign.class );
//crit.add( Example.create(campaign) );
System.out.println("searching the list");
return (List<Campaign>) getHibernateTemplate().findByExample( campaign );
}

which is the correct way to do it ?

thanks in advance,.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 13, 2009 5:44 pm 
Senior
Senior

Joined: Tue Aug 01, 2006 9:24 pm
Posts: 120
I prefer the find by example syntax as its just easier. However, both methods are correct. I don't believe there is a right or wrong answer just multiple ways to get the same result.

_________________
Please rate my replies as I need points for all of my questions also.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.