[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:
-------------------------------------------
Provided patch does not fix HQL to SQL translation issue. I will take a look what else needs to be changed - the bottom line is that if you navigate to the object using the model API then everything seems to work with the patch but when you want to execute an HQL then it is failing and again is looking for the column in the base table
> 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: 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
16 years, 3 months
[Hibernate-JIRA] Created: (HHH-3635) Hibernate Configuration.
by S Romender Singh (JIRA)
Hibernate Configuration.
------------------------
Key: HHH-3635
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3635
Project: Hibernate Core
Issue Type: Bug
Components: build
Affects Versions: 3.2.5
Environment: WAS 6.1 with multile Class loaders.
Reporter: S Romender Singh
For fast loading the Configuration.java is serialized in form of binary file.
Since the Configuration.java doesn't have serial version UID failing while de-serializing and this failure is also occur randomly.
java.io.InvalidClassException: org.dom4j.tree.AbstractNode; local class incompatible: stream classdesc serialVersionUID = 4188621179618565246, local class serialVersionUID = 4436254242831845461
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:519)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at java.util.ArrayList.readObject(ArrayList.java:591)
--
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
16 years, 3 months
[Hibernate-JIRA] Updated: (HHH-37) Nested instantiation using "select new"
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-37?page=com... ]
Steve Ebersole updated HHH-37:
------------------------------
Comment: was deleted
> Nested instantiation using "select new"
> ---------------------------------------
>
> Key: HHH-37
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-37
> Project: Hibernate Core
> Issue Type: New Feature
> Components: core
> Affects Versions: 3.0 alpha
> Environment: Hibernate 3.0 alpha
> Reporter: Regis Pires Magalhaes
> Assignee: Steve Ebersole
> Attachments: h3.0.1_grammar.patch, h3.0.1_src.patch, h3.0.1_src_b.patch, IteratorImpl.java, Loader.java, NestedHolderClass.java, QueryTranslatorImpl.java, ScrollableResultsImpl.java, SelectParser.java
>
>
> Our suggestion is to get lightweight objects from Hibernate using nested new's in HQL "select new" feature.
> Currently, the following HQL statement works fine:
> select new Store(store.id, store.description) from Store store
> However we can not do a nested instantiation like:
> select new Store(store.id, store.description, new Section(store.section.id, store.section.name)) from Store store
> We have done some custom changes in our Hibernate 3.0 alpha source code in order to support it.
> The changed classes were:
> org.hibernate.impl.IteratorImpl
> org.hibernate.loader.Loader
> org.hibernate.hql.QueryTranslatorImpl
> org.hibernate.impl.ScrollableResultsImpl
> org.hibernate.hql.SelectParser
> The new class is:
> org.hibernate.util.NestedHolderClass;
> We would like to know if Hibernate Team has some interest to analyse this contribution and maybe add this feature to future versions of Hibernate.
--
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
16 years, 3 months
[Hibernate-JIRA] Created: (ANN-636) Add the annotations to map the User Collection Type
by jason (JIRA)
Add the annotations to map the User Collection Type
---------------------------------------------------
Key: ANN-636
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-636
Project: Hibernate Annotations
Issue Type: New Feature
Components: binder
Environment: n/a
Reporter: jason
I am searching a way from the Hibernate Annotation to map the user defined collection, and find out the following :
Can anybody let me know what the status for this? or how i can map the user collection type by hibernate annotation, thanks
Add an annotation to specify the UserCollectionType for a OneToMany or ManyToMany.
The annotation is named CollectionTypeInfo, perhaps better named UserCollectionType, but I didn't know the standards for naming classes.
The change to AnnotationBinder is minor and is delineated by '//dwsjoquist//' comment lines.
Usage:
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "id")
@CollectionTypeInfo(name = "examples.MyUserCollectionType")
public List<ExampleAttribute> getExampleAttributes() {
--
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
16 years, 3 months
[Hibernate-JIRA] Commented: (ANN-141) Add annotation support for UserCollectionType
by tao wen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-141?page=co... ]
tao wen commented on ANN-141:
-----------------------------
I think I have found a solution without changing the hibernate code. Currently, to let the AnnotationConfiguration be able to handle UserCollectionType, there are to two issues. First, Ejb3ReflectionManager think the member is not a collection, so you will first get a "Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements" exception. This could be work around by change the reflection manager in AnnotationManager. Second issue is the typeName(which is the class name of your UserCollectionType class) property of Set mapping is null (of coz it is null, because there is no place to set it), so hibernate will use default SetType to handle it, which will cause runtime "setter unknown" exception. This could be workaround by post-process the configuration produced by AnnotationConfiguration.configure(), set the typeName for all the set mapping you think need to use your UserCollectionType.
Finally, it is a hack, not a solution.
> Add annotation support for UserCollectionType
> ---------------------------------------------
>
> Key: ANN-141
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-141
> Project: Hibernate Annotations
> Issue Type: Patch
> Components: binder
> Affects Versions: 3.1beta6
> Environment: All versions, database agnostic
> Reporter: Douglas Sjoquist
> Priority: Minor
> Attachments: UserCollectionTypeAnnotation.zip
>
> Original Estimate: 30 minutes
> Remaining Estimate: 30 minutes
>
> Add an annotation to specify the UserCollectionType for a OneToMany or ManyToMany.
> The annotation is named CollectionTypeInfo, perhaps better named UserCollectionType, but I didn't know the standards for naming classes.
> The change to AnnotationBinder is minor and is delineated by '//dwsjoquist//' comment lines.
> Usage:
> @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
> @JoinColumn(name = "id")
> @CollectionTypeInfo(name = "examples.MyUserCollectionType")
> public List<ExampleAttribute> getExampleAttributes() {
--
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
16 years, 3 months
[Hibernate-JIRA] Commented: (HHH-37) Nested instantiation using "select new"
by Terry Bhatti (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-37?page=com... ]
Terry Bhatti commented on HHH-37:
---------------------------------
This is sitting open since 2004, wish it had been done since.
> Nested instantiation using "select new"
> ---------------------------------------
>
> Key: HHH-37
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-37
> Project: Hibernate Core
> Issue Type: New Feature
> Components: core
> Affects Versions: 3.0 alpha
> Environment: Hibernate 3.0 alpha
> Reporter: Regis Pires Magalhaes
> Assignee: Steve Ebersole
> Attachments: h3.0.1_grammar.patch, h3.0.1_src.patch, h3.0.1_src_b.patch, IteratorImpl.java, Loader.java, NestedHolderClass.java, QueryTranslatorImpl.java, ScrollableResultsImpl.java, SelectParser.java
>
>
> Our suggestion is to get lightweight objects from Hibernate using nested new's in HQL "select new" feature.
> Currently, the following HQL statement works fine:
> select new Store(store.id, store.description) from Store store
> However we can not do a nested instantiation like:
> select new Store(store.id, store.description, new Section(store.section.id, store.section.name)) from Store store
> We have done some custom changes in our Hibernate 3.0 alpha source code in order to support it.
> The changed classes were:
> org.hibernate.impl.IteratorImpl
> org.hibernate.loader.Loader
> org.hibernate.hql.QueryTranslatorImpl
> org.hibernate.impl.ScrollableResultsImpl
> org.hibernate.hql.SelectParser
> The new class is:
> org.hibernate.util.NestedHolderClass;
> We would like to know if Hibernate Team has some interest to analyse this contribution and maybe add this feature to future versions of Hibernate.
--
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
16 years, 3 months
[Hibernate-JIRA] Created: (HHH-3365) SchemaUpdate still fails if conflicting table is visible in another user's tablespace
by John Wood (JIRA)
SchemaUpdate still fails if conflicting table is visible in another user's tablespace
-------------------------------------------------------------------------------------
Key: HHH-3365
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3365
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.3.0.CR1, 3.2.6, 3.1
Reporter: John Wood
Priority: Minor
This issue is a duplicate of HHH-2208. Despite what that other issue states, this doesn't seem to be fixed.
This issue still seems to a problem for us when using the SchemaUpdate tool to auto-update our tables (in Oracle).
We've tried this using the following hibernate versions: 3.1, 3.2.6ga, 3.3.0.CR1
In every case the bug still happens: the schema update tool tries to update a table called "JOB", finds a table in someone else's schema (which happens to have been made public), and then gets confused. It will either try to update the other user's JOB table, or (in our case), fails because it (quite rightly) doesn't have permissions to change the other user's table.
Here is how to reproduce:
1) Create your main DB user as normal (user1)
2) Create another user on the Oracle same database (user2)
3) On user2 create a new table which conflicts with a table in your generated DB ("job").
4) Make this new table visible to user1. One way of doing this is to give "insert" privildeges to "public":
grant insert on user2.job to public
5) Run the schema update tool for user1. This will fail: it tries to update the table in user2's schema (tablespace), and doesn't have permissions.
Note that this issue only occurs when the conflicting table is visible to user1: if the table was hidden (i.e. user1 had no visibility of the conflicting table), we would be OK.
It seems to me that either A) there is some confusion about when this issue was fixed, or B) this is a different issue to HHH-2208
--
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
16 years, 3 months