Amirs156 / generic-dao

Automatically exported from code.google.com/p/generic-dao
0 stars 0 forks source link

findByExemple Doesn't work #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a method that make a query via findByExample
2. Execute the methode
3. The list return contains the whole table

With an example containing my primary key I expect only one result but I
alway have the whole table.

I'm using Generic DAO 1.0

Here is an example of my way of using it.
UserObject implements IEntity<Long>
UserObjectManager extends IDao<UserObject, Long>
UserObjectManagerImpl extends GenericDao<UserObject, Long> implements
UserObjectManager 

UserObjet userObject = new UserObject();
userObject.setId(new Long(0));

List<UserObject> myList = userObjectManager.findByExample(userObject)

System.out.println("size = "+myList.size());
-> I got 1321;

How do I have to use this method, findByExemple.

if i performe the same query with a criteria it works
findByCriteria(Criteria.forClass(UserObject.class).add(Restrictions.eq("login",
login)))

Please, help

Thanks you

Original issue reported on code.google.com by syl.dest...@gmail.com on 6 Nov 2009 at 12:21