[jboss-user] [EJB 3.0] - Query parameter is modified and return as null

urswag do-not-reply at jboss.com
Sun Sep 3 17:55:49 EDT 2006


I use a stateless session bean this method.

In this query the first parameter textKey is set to password. 

The query returns a label object with textKey field value null.

It is completly unlogical, the property is different to the search property but an object is found.

And as consequence somewhere afte the call of the method the database field texkey will set to null.

anonymous wrote : 
  | 	public Label findByTextKey(String textKey, Language language) {
  | 
  | 		Label label = (Label) labelsMap.get(textKey);
  | 		if (label == null) {
  | 			Query query = manager.createQuery(
  | 				"from Label l where l.textKey = :textKey and l.language = :language");
  | 			query.setParameter("textKey", textKey);
  | 			query.setParameter("language", language);
  | 			try {
  | 				label = ((Label) query.getSingleResult());
  | 				labelsMap.put(textKey, label);
  | 			}
  | 			catch (NoResultException nre) {
  | 
  | 			}
  | 		}
  | 
  | 		return label;
  | 	}
  | 

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

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



More information about the jboss-user mailing list