[jboss-user] [EJB 3.0] - Re: naming of attributes in queries

micho do-not-reply at jboss.com
Fri Jan 19 05:25:34 EST 2007


@Entity
  | @Table(name = "Benutzer")
  | public class User implements Serializable
  | { private long   mSid;
  |   private long   mMandantID;
  |   private String mId;
  |   
  |   public User() 				{ super(); }
  |   public String getId()   		{ return mId;  }
  |   public void setId(String pId) { mId = pId;  }
  |   @Id @GeneratedValue(strategy=GenerationType.AUTO)
  |   public long getSid()			{ return mSid; }
  |   public void setSid(long pSid)	{ mSid = pSid; }
  |   public long getMandantID()	{ return mMandantID; }
  |   public void setMandantID(long pMandantID)	 { mMandantID = pMandantID; }
  | }
  | 
List<User> erg = (List<User>) em.createQuery(
  | "from User where (Id = :uid) and (pwd=:pwd) and (mandantID=:mandantid)")
  | .setParameter ("uid", pUserName).setParameter ("pwd", pPwd).setParameter ("mandantid", lMandantID).getResultList();
  | 
this works, 
mandantID, mandantid insted of MandantID works too
but id insted of Id doesn´t.

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

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




More information about the jboss-user mailing list