[jboss-user] [EJB 3.0] - Re: Aliases in Queries

mazz@jboss.com do-not-reply at jboss.com
Sat Feb 24 17:09:09 EST 2007


First, as I understand it, the @Column annotation defines the actual database column name but has no bearing on how the ORM tool identifies this column in the JPQL query language.

@Column(name = "peter")
  public String getHugo()

This entity's column is "Hugo" when you identify it in your JPQL queries.  "peter" is the actual name of the column in the database, and is used when the JPA implementation (Hibernate in JBoss EJB's case) builds the actual SQL that it sends to the database.  So, I definitely see why u.peter fails - it should be u.hugo.

I don't know what that first query is doing... "peter = :name". Turn on Hibernate SQL debugging (show_sql=true) to look at the actual SQL its issuing - that usually tells you alot about what's happening.

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

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



More information about the jboss-user mailing list