[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Getting a session from entityManager

mladen.babic do-not-reply at jboss.com
Sat Aug 4 16:23:04 EDT 2007


Hi ,

I 've tried to use query by example.Problem is thet I get error when I try to get session.This is  fragment of my code:
  | public List<DistributorEntity> findDistributors(String name,BigDecimal time,BigDecimal costs,String account){
  | 			DistributorEntity newDistributor=new DistributorEntity();
  | 			newDistributor.setName(name);
  | 			newDistributor.setDeliveryTime(time.intValue());
  | 			newDistributor.setDeliveryCosts(costs);
  | 			newDistributor.setAccount(account);
  | 			Session session = (Session)entityManager.getDelegate();
  | 			Example distributorExample=Example.create(newDistributor)
  | 								.ignoreCase()
  | 								.excludeZeroes()
  | 								.enableLike();
  | 			List list = session.createCriteria(DistributorEntity.class)
  | 										.add(distributorExample).list();
  | 			return list;
  | 

In debug mode I have found  that problem is in entityManager. getDelegate().It return null.How will i solve a problem?
Best regards,
mb

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070901#4070901

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070901



More information about the jboss-user mailing list