[Hibernate-JIRA] Created: (EJB-261) merge fails to update join table
by Bryan Hunt (JIRA)
merge fails to update join table
--------------------------------
Key: EJB-261
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-261
Project: Hibernate Entity Manager
Type: Bug
Components: EntityManager
Versions: 3.2.1
Environment: Embedded entity manager 3.2.1 with DB2 or MySQL
Reporter: Bryan Hunt
Priority: Blocker
Doing a merge on an entity with a one to many relationship does not update the join table.
I have the following entities:
@Entity
public class Foo
{
...
@OneToMany(cascade = CascadeType.ALL)
private Set<Bar> bars;
}
@Entity
public class Bar
{
...
}
The following works:
Foo foo = new Foo();
Bar bar = new Bar();
foo.getBars().add(bar);
em.getTransaction().begin();
em.persist(foo); // <<----------------- correctly updates the join table
em.getTransaction().commit();
This also works:
Foo foo = em.find(Foo.class, id);
Bar bar = new Bar();
foo.getBars().add(bar);
em.getTransaction().begin();
em.persist(bar);
em.merge(foo); // <<----------------- correctly updates the join table
em.getTransaction().commit();
When this code executes the new Foo and Bar are persisted to the database, an entry is made into the join table, and all is well.
The following fails:
Foo foo = em.find(Foo.class, id);
Bar bar = new Bar();
foo.getBars().add(bar);
em.getTransaction().begin();
em.merge(foo); // <<----------------- does not update the join table
em.getTransaction().commit();
When this code executes, the new Bar is persisted to the database, but the join table is not updated.
--
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, 10 months
[Hibernate-JIRA] Created: (HHH-2034) Potential ClassCastException in catch block in NullableType
by Galen Palmer (JIRA)
Potential ClassCastException in catch block in NullableType
-----------------------------------------------------------
Key: HHH-2034
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2034
Project: Hibernate3
Type: Improvement
Components: core
Versions: 3.1.3
Environment: Hibernate 3.1.3
Reporter: Galen Palmer
Priority: Minor
It is possible to throw an exception from within the catch block of NullableType.nullSafeSet() since the toString(value) method calls in many cases (e.g. StringType) simply result in a cast of return (String)value. This may mask the underlying problem for the users.
A proposed solution would be to replace the call in the catch blog of toString(value) with a reference to value. For example:
line 87:
log().info( "could not bind value '" + value + "' to parameter: " + index + "; " + re.getMessage() );
and line 91:
log().info( "could not bind value '" + value + "' to parameter: " + index + "; " + se.getMessage() );
This change would prevent the catch block from throwing the exception.
--
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, 10 months
[Hibernate-JIRA] Created: (ANN-531) EntityMode.DOM4J does not deserialize collection entities
by Laurent Perez (JIRA)
EntityMode.DOM4J does not deserialize collection entities
---------------------------------------------------------
Key: ANN-531
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-531
Project: Hibernate Annotations
Type: Bug
Components: binder
Versions: 3.2.2
Environment: PATCH ANN-517 APPLIED (see http://opensource.atlassian.com/projects/hibernate/browse/ANN-517), revision 11026.
Reporter: Laurent Perez
The XML deserialization of an entity does not deserializes its child properties but only its id, following sample :
Foobean are children of a Screen :
@Entity
@Table (name="foobean")
public class Foobean implements java.io.Serializable {
private String name;
private String age;
private Screen screen;
@Id
@Column(name="name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@ManyToOne
public Screen getScreen() {
return this.screen;
}
public void setScreen(Screen screen) {
this.screen = screen;
}
@Column(name="age")
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
}
Relevant parent Screen annotations :
private Set<Foobean> fooBeans = new HashSet<Foobean>();
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
public Set<Foobean> getFoobeans(){
return this.fooBeans;
}
public void setFoobeans(Set<Foobean> fooBeans) {
this.fooBeans = fooBeans;
}
Association :
Foobean foobean = new Foobean();
foobean.setName("foo");
foobean.setAge("age");
foobean.setScreen(screen);
screen.getFoobeans().add(foobean);
Generated XML (the age property of Foobean is missing, i.e there is no <name>foo</name><age>age</age>) :
<Screen>
<id>1</id>
<foobeans>
<Foobean>foo</Foobean>
</foobeans>
</Screen>
--
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, 10 months