[Hibernate-JIRA] Created: (EJB-396) Cascading delete has problem removing entity after its dependent is removed
by Wade Routen (JIRA)
Cascading delete has problem removing entity after its dependent is removed
---------------------------------------------------------------------------
Key: EJB-396
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-396
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.4.0.GA
Reporter: Wade Routen
Attachments: hibernatebug.zip
Hello Hibernate people,
I searched through your forums trying to find any mention of the problem I have ran into and normally I would post this to your forums to see if anyone would give me a response but I'm new to the forums and didn't see a spot to attach code other than inline on my message, however, this takes a bit more than can be posted inline. I have attached the code to reproduce the issue I'm seeing and it is a quite strange one at that. Here's the problem:
In the code there are 3 entities set up; Directory, Person, and Blacklisted. Directory has a "one to many" relationship on both Person and Blacklisted. Person has a "many to one" on Directory, and Blacklisted has a "many to one" on Directory and Person. When the cascade for the delete occurs for directory, given the way the Directory is currently setup in the example code, the Person relationship is evaluated and deleted first for the cascade and is deleted successfully. Next the Blacklisted relationship is evaluated which is where the problem comes into play. The Person entity is marked as "DELETED" and there for is marked as NULL within the Blacklisted "DeletedState" via this method call
(Line: 270 of DefaultDeleteEventListener) new ForeignKeys.Nullifier( entity, true, false, session ).nullifyTransientReferences( entityEntry.getDeletedState(), propTypes );
When the next line executes the Nullability check, the "Person" reference (which is not null in the entity) is checked for Nullability, the deletion fails out claiming that the entity is null and can not be due to the fact that is was nulled out in the entity's DeletedState. The thing is that this only happens when the Directory entity's column field references are arranged a certain way. It's hard to explain but the code will show you that if the "people" field is alphabetically before the Blacklisted field, currently named "suspended" in the example code, this problem occurs. If you were to rename the "suspended" field to "blacklisted", or anything alphabetically before "people", the problem does not occur and the cascading delete goes through without a hitch. Now obviously Hibernate processes fields on the cascade in alphabetical order, and if not maybe the Nullifier shouldn't be nulling out the entity for cascade in the Delete State. At any rate I suppose that's for you guys to figure out. I hope this is helpful...
Regards,
Wade Routen
--
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: (HSEARCH-267) Inheritance of annotations and analyzer
by Ulrich Vachon (JIRA)
Inheritance of annotations and analyzer
---------------------------------------
Key: HSEARCH-267
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-267
Project: Hibernate Search
Issue Type: Bug
Components: analyzer
Affects Versions: 3.0.1.GA
Reporter: Ulrich Vachon
I have this hierarchical classes : Class0 extends Class1 extends Class2 extends Class 3 (see code example).
When I index my entity (Class0), HS don't use my CompoundMetaphoneAnalyzer to index my property "name" but the Hibernate raw value (ie: Procaïne). If I add the @Indexed annotation and @Analyzer to class Class2, HS use my CompoundMetaphoneAnalyzer and my index contain the value (ie: procaine).
// class 3
public abstract class Class3 {
private Integer id;
@DocumentId
public Integer getId() {
return id;
}
}
// class 2
public abstract class Class2 extends Class3 {
protected String name;
@Fields( {@Field(name = IndexedEntity.NAME, index = Index.TOKENIZED, store = Store.YES), @Field(name = IndexedEntity.METAPHONE, index = Index.TOKENIZED, store = Store.YES)})
public String getName() {
return name;
}
}
// class 1
public abstract class Class1 extends Class2 {
// nothing...
}
// class 0
@Indexed
@Analyzer(impl = CompoundMetaphoneAnalyzer.class)
public class Class0 extends Class1 {
// code...
}
--
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] Resolved: (HBX-524) Reverse of one-to-one relationships
by Anthony Patricio (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-524?page=co... ]
Anthony Patricio resolved HBX-524.
----------------------------------
Resolution: Fixed
Fix Version/s: 3.2.2
> Reverse of one-to-one relationships
> -----------------------------------
>
> Key: HBX-524
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-524
> Project: Hibernate Tools
> Issue Type: Bug
> Components: reverse-engineer
> Affects Versions: 3.1beta2
> Environment: HIbernate 3.1, Oracle 9i
> Reporter: Andrea Cattani
> Assignee: Anthony Patricio
> Fix For: 3.2.2
>
> Attachments: HBX-524.patch, HBX-524v2.patch, one-to-one-marcio.patch, patch.txt
>
>
> Hi,
> I've posted this issue to the forum and got this response from Max, Hibernate Team:
> "the reveng tools does not detect this as a one-to-one. it probably could, so add a request/patch to jira."
> The problem I've faced is the following:
> I have two tables, let's say
> - table A with column ID (PK) and other fields
> - table B with column ID (PK) and other fields
> table B has a foreign key constraint against table A, from column ID to column ID (one-to-one)
> When I reverese the tables with the HibernateTools I have such a resultant mapping for table B:
> <class name="B" table="B" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned" />
> </id>
> <[b]many-to-one name[/b]="a" class="A" update="false" insert="false" fetch="select">
> <column name="ID" length="12" not-null="true" unique="true" />
> </many-to-one>
> ....
> And this one for table A:
> <class name="A" table="A" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned"/>
> </id>
> <set name="b" inverse="true">
> <key>
> <column name="ID" length="12" not-null="true" unique="true" />
> </key>
> <[b]one-to-many[/b] class="B" />
> </set>
> </class>
> while I was expecting something like:
> [i]<one-to-one name="a" class="A" constrained="true"/>[/i]
> in table B, and the same (or nothing) in table A
> Thank you
> Andi
--
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-1657) hql update generate wrong sql with joined subclass hierarcy
by John Baker (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657?page=c... ]
John Baker commented on HHH-1657:
---------------------------------
Hello,
Perhaps I'm confused, but this bug has wasted an awful lot of my time because Hibernate can not perform some of the most basic functions: Deleting and updating. What makes this even worse is that there appear to be patches floating about and it really can't be that hard to fix! Allowing an on-cascade on a one to one relationship would seem a pretty trivial fix for anyone who understand the source, so not only is the bug a high priority, but the fixes do not seem overly difficult.
Come on chaps - Hibernate is a wonderful product so please fix these obvious important bugs!
John
> hql update generate wrong sql with joined subclass hierarcy
> -----------------------------------------------------------
>
> Key: HHH-1657
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Environment: Hibernate 3.2.0cr1, Hibernate 3.1.3
> Reporter: Alexey Romanchuk
> Assignee: Gail Badner
>
> Let suppose that we have two joined subclass entities: Parent (id PK) and Child (id PK) that mapped with joined subclass method.
> When I try to update Child by id with hql:
> update Child c set c.field = 'value' where c.id = 1234
> hibernate generates joined tables like
> insert into HT_parent select child0_.id as id from child child0_ inner join parent child0_1_ on child0_.id=child0_1_.id wher id in = 1234
> look at last condition. hibernate use id WITH OUT tables alias that cause sql exception: column reference "id" is ambiguous
--
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-1657) hql update generate wrong sql with joined subclass hierarcy
by Peter Lupo (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657?page=c... ]
Peter Lupo commented on HHH-1657:
---------------------------------
Yeah, really. Only queries don't work with joined subclasses. People are moving to other JPA implementations and even other ASs. So, as people can choose other JPA implementations as a workaround, no big deal on this bug. Maybe it could be changed to minor as it only affects hibernate users.
> hql update generate wrong sql with joined subclass hierarcy
> -----------------------------------------------------------
>
> Key: HHH-1657
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Environment: Hibernate 3.2.0cr1, Hibernate 3.1.3
> Reporter: Alexey Romanchuk
> Assignee: Gail Badner
>
> Let suppose that we have two joined subclass entities: Parent (id PK) and Child (id PK) that mapped with joined subclass method.
> When I try to update Child by id with hql:
> update Child c set c.field = 'value' where c.id = 1234
> hibernate generates joined tables like
> insert into HT_parent select child0_.id as id from child child0_ inner join parent child0_1_ on child0_.id=child0_1_.id wher id in = 1234
> look at last condition. hibernate use id WITH OUT tables alias that cause sql exception: column reference "id" is ambiguous
--
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