[Hibernate-JIRA] Commented: (HHH-1525) multiple cascades to the same transient instance within a single object graph
by Steve Mayhew (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1525?page=c... ]
Steve Mayhew commented on HHH-1525:
-----------------------------------
I humbly asset that this may be an instance of this issue:
<class name="Base">
<many-to-one name="bar" class="Bar" not-null="true" cascade="delete" />
...
<joined-subclass name="A" extends="Base">
...
<joined-subclass name="B" extends="Base">
...
Hibernate delete,
List list = session.createCriteria(Base.class).list();
for (Iterator it = list.iterator(); it.hasNext();) {
session.delete(it.next());
}
This will throw a org.hibernate.PropertyValueException: not-null property references a null or transient value.
Am I missing something?
> multiple cascades to the same transient instance within a single object graph
> -----------------------------------------------------------------------------
>
> Key: HHH-1525
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1525
> Project: Hibernate3
> Type: Improvement
> Components: core
> Reporter: Steve Ebersole
> Assignee: Steve Ebersole
>
>
> Consider an object graph being saved that contains the same transient instance multiple times (at diffierent levels in the graph) where some of the associations define cascading and some do not and that the associations without cascading are further defined as not-null. Based on the order in which the associations are cascaded there is a potential for that transient instance to cause an "unsaved transient instance" exception if the non-cascaded and not-null association is cascaded to first, even though a subsequent cascaced would in fact cause the instance to become managed.
> Typically this is easy enough to work around by simply reordering the associations in the mapping so that the cascaded association is before the non-cascaded one. However, this is not always possible (the case of inheritence hierarchies comes to mind, where the superclass associations are always cascaded to first).
--
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
17 years, 3 months
[Hibernate-JIRA] Created: (HHH-2368) Bulk delete fails when entity has a collection of composite-elements
by Rob Hasselbaum (JIRA)
Bulk delete fails when entity has a collection of composite-elements
--------------------------------------------------------------------
Key: HHH-2368
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2368
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.1
Environment: Hibernate 3.2.1, Oracle 10g
Reporter: Rob Hasselbaum
If an entity is mapped with a set of components ("composite-elements"), bulk delete of the entity fails with a foreign key constraint violation because Hibernate does not delete the contents of the child table. For example, suppose we have two POJOs:
public class Person {
private Long m_id;
private Set m_aliases = new HashSet();
.. getters and setters not shown ...
}
public class Name {
private String m_lastName;
.. getter and setter not shown ...
}
And the entity is mapped as follows:
<class name="Person" table="tbl_person">
<id name='id' column='objid'>
<generator class='native'/>
</id>
<set name="aliases" table="tbl_name_aliases" lazy="false" cascade="all,delete-orphan">
<key column="person_id"/>
<composite-element class="Name" >
<property name="lastName" column="last_name"/>
</composite-element>
</set>
</class>
The following code generates an integrity constraint violation:
Session sess = getSessionFactory().getCurrentSession();
Person person = new Person();
Name name = new Name();
name.setLastName("Smith");
person.getAliases().add(name);
sess.saveOrUpdate(person);
sess.flush();
sess.createQuery("delete from Person").executeUpdate(); // FAILS!
--
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
17 years, 3 months
[Hibernate-JIRA] Created: (ANN-511) Two level @Valid annotation doesn't work
by Rakesh Kalra (JIRA)
Two level @Valid annotation doesn't work
-----------------------------------------
Key: ANN-511
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-511
Project: Hibernate Annotations
Type: Bug
Components: validator
Versions: 3.2.1
Environment: hibernate-annotations 3.2.1.ga
Reporter: Rakesh Kalra
I have object depth of 3: Form, Member, Address. I get the following exception when initializing ClassValidator:
java.lang.NullPointerException
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:142)
at org.hibernate.validator.ClassValidator.createChildValidator(ClassValidator.java:252)
at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:216)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:149)
at org.hibernate.validator.ClassValidator.createChildValidator(ClassValidator.java:252)
at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:216)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:134)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:105)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:97)
...
This works fine with 3.2.0.ga.
I think the problem is in the following constructor, where instance level "reflectionManager" is not being initialized.
protected ClassValidator(
XClass beanXClass, ResourceBundle resourceBundle, MessageInterpolator userInterpolator,
Map<XClass, ClassValidator> childClassValidators, ReflectionManager reflectionManager
) {
this.beanClass = reflectionManager.toClass( beanXClass );
this.messageBundle = resourceBundle == null ?
getDefaultResourceBundle() :
resourceBundle;
this.defaultMessageBundle = ResourceBundle.getBundle( DEFAULT_VALIDATOR_MESSAGE );
this.userInterpolator = userInterpolator;
this.childClassValidators = childClassValidators;
initValidator( beanXClass, childClassValidators );
}
The other constructor initializes reflectionManager.
--
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
17 years, 3 months
[Hibernate-JIRA] Commented: (HHH-1916) param values in generator element should be trimmed during HbmBinding
by Renaud Bruyeron (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1916?page=c... ]
Renaud Bruyeron commented on HHH-1916:
--------------------------------------
Hello,
I was wondering if this issue fell through the gaps? 3.2.1GA still has this issue. The patch is a trivial one-liner, I can't see any reason not to apply it.
> param values in generator element should be trimmed during HbmBinding
> ---------------------------------------------------------------------
>
> Key: HHH-1916
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1916
> Project: Hibernate3
> Type: Bug
> Components: metamodel
> Versions: 3.1.3, 3.2.0.cr3
> Environment: Oracle 10g, JDK 1.5.0_06, linux, hibernate 3.1.3
> Reporter: Renaud Bruyeron
> Attachments: patch-Branch_3_1.txt, patch-Branch_3_2.txt
>
>
> When using IDEs or tools like xdoclet to generate HBM files, it is easy to get XML like this:
> <generator class="sequence">
> <param
> name="sequence"
> >
> SEQ_SOME_SEQUENCE
> </param>
> </generator>
> However the SchemaValidator barfs on this because the HbmBinder does not trim the sequence name.
> The fix is similar to the fix for HBX-423 I believe, i.e. in HbmBinder.java in method makeIdentifier(...), use getTextTrim() instead of getText().
> In 3.1 branch, this is at line 1902. On trunk this is line 1990.
--
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
17 years, 3 months