I'm using annotations version 3.4.0.GA to map onto postgresql DB where a lot of fields are case-sensitive. Everything works except this particular bidirectional relationship I just added. Here is the relevant part of setup:
Code:
@Entity
@Table(name= "\"Event\"")
@Filter(name="existent")
public class Event implements Auditable {
@OneToMany(cascade=CascadeType.ALL, mappedBy="event")
@Filters({
@Filter(name="unarchived"),
@Filter(name="existent")
})
private Collection<Order> orders;
........
}
@Entity
@Filter(name="existent")
@Table(name="\"Order\"")
public class Order implements Auditable, Distributable {
@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(name="\"Event_ID\"")
@Filter(name="existent")
private Event event;
..........
}
This is the tail end of a query being generated and I can see the column name Event_ID is not quoted (very last condition in where clause) and thus blowing up. Everywhere else column names work fine. Any idea if this is a bug or I have not setup correctly?
........
left outer join "Event" event8_ on orders0_."Event_ID"=event8_."Event_ID" left outer join "Order_Priority" orderprior9_ on orders0_."Order_Priority_ID"=orderprior9_."Order_Priority_ID" where orders0_."Delete_Timestamp" is null and orders0_."Archive" is null or orders0_."Archive" <> 'Y' and orders0_.Event_ID=?
2012-02-28 23:22:02,301 WARNING [org.hibernate.util.JDBCExceptionReporter] (http-0.0.0.0-8080-8) SQL Error: 0, SQLState: 42703
2012-02-28 23:22:02,302 SEVERE [org.hibernate.util.JDBCExceptionReporter] (http-0.0.0.0-8080-8) ERROR: column orders0_.event_id does not exist
Position: 8
2012-02-28 23:22:02,308 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/photoerp].[Spring MVC Dispatcher Servlet]] (http-0.0.0.0-8080-8) Servlet.service() for servlet Spring MVC Dispatcher Servlet threw exception
org.postgresql.util.PSQLException: ERROR: column orders0_.event_id does not exist
Position: 8
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:271)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:342)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1812)
at org.hibernate.loader.Loader.doQuery(Loader.java:697)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.loadCollection(Loader.java:2019)
at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:59)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:587)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1744)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:366)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
at org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:272)