Hi Rob, I am migrating an Oracle based project from 1.0.3 to 1.1.0 and found a problem:
the query with 1.0.3 was:
select * from (
select row_number() over (order by p.data_erogazione desc) as rn, p.id c0, p.data_erogazione c1
, t.id c2, t.descrizione c3
, b.id c4, b.cognome c5, b.nome c6
from CISE_PRESTAZIONE p
join CISE_TIPO_PRESTAZIONE t on p.ID_TIPO = t.ID
join PERSONE b on p.ID_BENEFICIARIO = b.ID
order by p.data_erogazione desc
) where rn <= 101
with 1.1.0 the query has no column alias:
select * from (
select row_number() over (order by p.data_erogazione desc) as rn, p.id, p.data_erogazione
, t.id, t.descrizione
, b.id, b.cognome, b.nome
from CISE_PRESTAZIONE p
join CISE_TIPO_PRESTAZIONE t on p.ID_TIPO = t.ID
join PERSONE b on p.ID_BENEFICIARIO = b.ID
order by p.data_erogazione desc
) where rn <= 101
The log:
INFO: Ebean Version[1.1.0-090330] Java Version[1.6.0_10]
...
...
Exception in thread "AWT-EventQueue-0" javax.persistence.PersistenceException: Query threw SQLException:ORA-00918: column ambiguously defined
Query was:
select * from (
select row_number() over (order by p.data_erogazione desc) as rn, p.id, p.data_erogazione
, t.id, t.descrizione
, b.id, b.cognome, b.nome
from CISE_PRESTAZIONE p
join CISE_TIPO_PRESTAZIONE t on p.ID_TIPO = t.ID
join PERSONE b on p.ID_BENEFICIARIO = b.ID
order by p.data_erogazione desc
) where rn <= 101
at com.avaje.ebean.server.query.CQueryEngine.findMany(CQueryEngine.java:110)
at com.avaje.ebean.server.query.DefaultOrmQueryEngine.findMany(DefaultOrmQueryEngine.java:93)
at com.avaje.ebean.server.core.QueryRequest.findList(QueryRequest.java:207)
at com.avaje.ebean.server.core.DefaultServer.findList(DefaultServer.java:1022)
at com.avaje.ebean.query.DefaultOrmQuery.findList(DefaultOrmQuery.java:490)
at verificheise.EbeanPersistenceDelegate.select(EbeanPersistenceDelegate.java:33)
at it.fc.cesena.comune.datacontrols.datasource.AbstractDatasource.load(AbstractDatasource.java:414)
at verificheise.forms.Prestazioni.init(Prestazioni.java:229)
at verificheise.SmartPanel.setVisible(SmartPanel.java:31)
at javax.swing.JTabbedPane.fireStateChanged(JTabbedPane.java:378)
at javax.swing.JTabbedPane$ModelListener.stateChanged(JTabbedPane.java:253)
at javax.swing.DefaultSingleSelectionModel.fireStateChanged(DefaultSingleSelectionModel.java:116)
at javax.swing.DefaultSingleSelectionModel.setSelectedIndex(DefaultSingleSelectionModel.java:50)
at javax.swing.JTabbedPane.setSelectedIndexImpl(JTabbedPane.java:599)
at javax.swing.JTabbedPane.setSelectedIndex(JTabbedPane.java:574)
at org.jvnet.substance.SubstanceTabbedPaneUI$MouseRolloverHandler.mousePressed(SubstanceTabbedPaneUI.java:468)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:262)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:262)
at java.awt.Component.processMouseEvent(Component.java:6131)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5899)
at java.awt.Container.processEvent(Container.java:2023)
at java.awt.Component.dispatchEventImpl(Component.java:4501)
at java.awt.Container.dispatchEventImpl(Container.java:2081)
at java.awt.Component.dispatchEvent(Component.java:4331)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3962)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
at java.awt.Container.dispatchEventImpl(Container.java:2067)
at java.awt.Window.dispatchEventImpl(Window.java:2458)
at java.awt.Component.dispatchEvent(Component.java:4331)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.sql.SQLException: ORA-00918: column ambiguously defined
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:626)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:182)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:500)
at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:942)
at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:532)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1037)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2916)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:2957)
at com.avaje.ebean.server.lib.sql.ExtendedPreparedStatement.executeQuery(ExtendedPreparedStatement.java:146)
at com.avaje.ebean.server.query.CQuery.prepareBindExecuteQuery(CQuery.java:332)
at com.avaje.ebean.server.query.CQueryEngine.findMany(CQueryEngine.java:87)
... 37 more