[Hibernate-JIRA] Commented: (HBX-615) reveng.xml changes/addition
by Jerry Shea (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-615?page=co... ]
Jerry Shea commented on HBX-615:
--------------------------------
Hi Max, this issue says it is fixed in 3.1 and yet I cannot use the "<from-sql-type native-type ..." stanza you suggest above in my reveng.xml file. Hibernate tools complains about the from-sql-type "... Element type "from-sql-type" must be declared." when reverse engineering run in eclipse.
I am using 3.2.4GA (3.2.4.v200910211631N-H194-GA)
> reveng.xml changes/addition
> ---------------------------
>
> Key: HBX-615
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-615
> Project: Hibernate Tools
> Issue Type: Improvement
> Affects Versions: 3.1beta4
> Reporter: Max Rydahl Andersen
> Fix For: 3.1.beta5
>
>
> <key-column> instead of <column> in primary key (difference, key-column cannot be excluded)
> <column foreign-x> not allowed, use foreign-key def instead:
> <primary-key>
> <column name="CUSTID" foreign-table="CUSTOMER" foreign-column="CUSTID" />
> </primary-key>
> becomes
> <primary-key>
> <key-column name="CUSTID"/>
> </primary-key>
> <foreign-key foreign-table="CUSTOMER">
> <column-ref local-column="CUSTID" foreign-column="CUSTID"/>
> </foreign-key>
> adding others as comments
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 3 months
[Hibernate-JIRA] Commented: (HHH-1015) Incorrect SQL generated when one-to-many foreign key is in a discriminated subclass table
by Krasimir Chobantonov (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1015?page=c... ]
Krasimir Chobantonov commented on HHH-1015:
-------------------------------------------
Alexander,
You can checkout the Hibernate Core (version 3.3.2.GA) from here http://anonsvn.jboss.org/repos/hibernate/core/tags/hibernate-3.3.2.GA/
and then you need to apply the patch that I have attached and build the jar file that you have requested.
Hopefully the Hibernate team will find some time to fix and include a bugfix in the next Hibernate production release (3.5.0-CR2 is a development release)
Unfortunatelly this is a bug that was reported in 2005 and it is still unassigned....
Krasimir
> Incorrect SQL generated when one-to-many foreign key is in a discriminated subclass table
> -----------------------------------------------------------------------------------------
>
> Key: HHH-1015
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1015
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1 beta 2
> Environment: Hibernate versions 3.1 beta 3 and 3.0.5
> Reporter: Steven Grimm
> Priority: Minor
> Attachments: 3.3.2.GA-HHH-1015-v1.patch, hhh-1015-version2.patch, hhh-1015.patch
>
>
> I have the following mappings describing a hierarchy of events and a class that the events refer to:
> <hibernate-mapping package="com.xyz">
> <class name="Event" table="event" discriminator-value="-1">
> <id name="Id" type="long" column="event_id"/>
> <discriminator column="event_type_id" type="integer" />
> <subclass name="EventPayer" discriminator-value="-3">
> <join table="event_payer">
> <key column="event_id" />
> <many-to-one name="payer" column="payer_id" class="Payer" />
> </join>
> <subclass name="EventPayerCreated" discriminator-value="1" />
> </subclass>
> </class>
> <class name="Payer" table="payer">
> <id name="payerId" column="payer_id" type="java.lang.Long"/>
> <set name="eventPayers" inverse="true" cascade="save-update">
> <key column="payer_id"/>
> <one-to-many class="EventPayer"/>
> </set>
> </class>
> </hibernate-mapping>
> When I fetch the Payer.eventPayers collection, Hibernate generates this SQL:
> select eventpayer0_.payer_id as payer7_1_,
> eventpayer0_.event_id as event1_1_,
> eventpayer0_.event_id as event1_5_0_,
> eventpayer0_1_.payer_id as payer2_6_0_,
> eventpayer0_.event_type_id as event2_5_0_
> from event eventpayer0_
> inner join event_payer eventpayer0_1_
> on eventpayer0_.event_id=eventpayer0_1_.event_id
> where eventpayer0_.payer_id=?
> The problem is that there is no event.payer_id column; payer_id is in the child table, not the parent. It appears that specifying a discriminated subclass in <one-to-many> is the same as specifying the superclass, or that Hibernate is ignoring the subclass's <join> element. As far as I can tell, this leaves no way to resolve bidirectional associations where one end of the association is in a discriminated subclass, which seems like a perfectly reasonable thing to want to do.
> I also tried changing <key column="payer_id"/> to <key property-ref="payer"/> in the Payer class's <set> element, but got similar behavior in the form of a "property not found" error: Hibernate is either looking in the superclass's properties rather than the subclass's or is ignoring the list of properties in the <join> element.
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 3 months
[Hibernate-JIRA] Created: (HHH-4931) two tests in org.hibernate.test.legacy.MultiTableTest fail on Ingres
by Strong Liu (JIRA)
two tests in org.hibernate.test.legacy.MultiTableTest fail on Ingres
--------------------------------------------------------------------
Key: HHH-4931
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4931
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-CR-1
Environment: ingres 9.3
Reporter: Strong Liu
Assignee: Strong Liu
testMultiTable(org.hibernate.test.legacy.MultiTableTest)
testMultiTableGeneratedId(org.hibernate.test.legacy.MultiTableTest)
-------------------------
20:37:55,892 WARN JDBCExceptionReporter:100 - SQL Error: 2925, SQLState: 5000A
20:37:55,893 ERROR JDBCExceptionReporter:101 - SELECT: FOR UPDATE clause found in non-updatable SELECT statement.
May not use set function, GROUP, HAVING, DISTINCT, UNION, ORDER or more
than one variable in the FROM clause, at the outermost query level.
20:37:55,895 INFO DefaultLoadEventListener:160 - Error performing load command
org.hibernate.exception.GenericJDBCException: could not load an entity: [org.hibernate.test.legacy.Top#1]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:132)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:120)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1921)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:71)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:65)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3212)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
at org.hibernate.event.def.DefaultLoadEventListener.lockAndLoad(DefaultLoadEventListener.java:403)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:155)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1080)
at org.hibernate.impl.SessionImpl.load(SessionImpl.java:1045)
at org.hibernate.impl.SessionImpl.load(SessionImpl.java:1036)
at org.hibernate.test.legacy.MultiTableTest.testMultiTable(MultiTableTest.java:343)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at org.hibernate.junit.functional.FunctionalTestCase.runTest(FunctionalTestCase.java:125)
at junit.framework.TestCase.runBare(TestCase.java:127)
at org.hibernate.junit.UnitTestCase.runBare(UnitTestCase.java:63)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: com.ingres.gcf.util.SqlEx: SELECT: FOR UPDATE clause found in non-updatable SELECT statement.
May not use set function, GROUP, HAVING, DISTINCT, UNION, ORDER or more
than one variable in the FROM clause, at the outermost query level.
at com.ingres.gcf.jdbc.DrvObj.readError(Unknown Source)
at com.ingres.gcf.jdbc.JdbcStmt.readError(Unknown Source)
at com.ingres.gcf.jdbc.DrvObj.readResults(Unknown Source)
at com.ingres.gcf.jdbc.JdbcStmt.readResults(Unknown Source)
at com.ingres.gcf.jdbc.JdbcStmt.readResults(Unknown Source)
at com.ingres.gcf.jdbc.JdbcPrep.exec(Unknown Source)
at com.ingres.gcf.jdbc.JdbcPrep.executeQuery(Unknown Source)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1832)
at org.hibernate.loader.Loader.doQuery(Loader.java:719)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:271)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1907)
... 30 more
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 3 months