Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating Criteria by Example.create

 
vijay chaudhary
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I Have created a class AirlineZoneMappings
The .hbm.xml file is

and POJO for this is

and the POJO for "ServiceMerchantMappings" class is


and .hbm.xml file is

The POJO for "ServiceMerchantMappingsId "




so when i writing the code for getting the AirLineZoneMapping Objects
where i have to pass the MerchnatId and the Service Id


The code i have wriiten is


------------------------
The Query executed by Hibernate discard the "obj_ServiceMerchantMappings" object where i have set the Merchantid and service id
It executing the Query like "select * from AIRLINE_ZONE_MAPPINGS"
Not including any where clause.

Please help me figure out this problem.


[Editied to add code tags - Paul Sturrock]
[ August 22, 2006: Message edited by: Paul Sturrock ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what is your code for objAirlineZoneMappingsDAO.findByExample

So we can see where the Query is actually created.

Remember to use the CODE tags around your code to keep it formatted. It is below the Add Reply Button.

Mark
 
vijay chaudhary
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Code for findByExample is

public List findByExample(AirlineZoneMappings instance) {

try {
List results = getSession()
.createCriteria("com.igt.atg.persistance.masters.AirlineZoneMappings")
.add(Example.create(instance))
.list();
log.debug("find by example successful, result size: " + results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic