[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5114) Column 'timestamp' in field list is ambiguous

ChB (JIRA) noreply at atlassian.com
Wed Apr 14 10:02:58 EDT 2010


Column 'timestamp' in field list is ambiguous
---------------------------------------------

                 Key: HHH-5114
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5114
             Project: Hibernate Core
          Issue Type: Bug
    Affects Versions: 3.5.0-Final
         Environment: MySQL 5.1.45, MySQL5InnoDBDialect
            Reporter: ChB


I ran into the following error today: 'Column 'timestamp' in field list is ambiguous'

So i tried to figure out what is causing this. I have the following mapping (

public class X
	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "y")
	@org.hibernate.annotations.Fetch(FetchMode.JOIN)
	public Y getY() {
		return this.y;
	}
}

public class Y
	@OneToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "x_id", unique = true, nullable = false, insertable = false, updatable = false)
	public X getX() {
		return this.x;
	}
}

and had the following Query "select x from X as y ..." which resulted in

select
 bla0_.x_id as x_id1_5_4_,
 bla0_.xyz as xyz2_5_4_,
 timestamp as timestamp5_4_,
 foo1_.id as id3_0_,
 ...
 bla4_.x_id as x_id1_5_3_,
 bla4_.xyz as xyz2_5_3_,
 timestamp as timestamp5_3_
from Y bla0_
left outer join X foo1_ on bla0_.x_id=foo1_.id
...
left outer join Y bla4_ on foo1_.id=bla4_.x_id


As you can obviously see this is a combination of 2 bugs:
1.) The text 'bla0_.' is missing prior to 'timestamp' (first occurence) and 'bla4_.' is missing prior to 'timestamp' (next occurence)
2.) For no reason the table Y is loaded twice from the DB (as bla0_ and bla4_)

This might be dialect specific, I'm using MySQL5InnoDBDialect.

I could work around this by removing "@org.hibernate.annotations.Fetch(FetchMode.JOIN)", but thats not a real solution. This did not happend with hibernate 3.3.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list