[Hibernate-JIRA] Created: (HHH-2738) Eager fetch support for StatelessSession
by Christian Bauer (JIRA)
Eager fetch support for StatelessSession
----------------------------------------
Key: HHH-2738
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2738
Project: Hibernate3
Issue Type: Task
Components: core
Reporter: Christian Bauer
class Node {
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "PARENT_NODE_ID", nullable = true)
protected Node parent;
}
StatelessSession ss = getStatelessSession();
Node node = (Node) ss.get(Node.class, nodeId);
[testng] org.hibernate.AssertionFailure: possible non-threadsafe access to the session
[testng] at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:100)
[testng] at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:854)
[testng] at org.hibernate.loader.Loader.doQuery(Loader.java:729)
[testng] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
[testng] at org.hibernate.loader.Loader.loadEntity(Loader.java:1860)
[testng] at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
[testng] at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
[testng] at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3042)
[testng] at org.hibernate.impl.StatelessSessionImpl.get(StatelessSessionImpl.java:158)
[testng] at org.hibernate.impl.StatelessSessionImpl.get(StatelessSessionImpl.java:153)
[testng] at org.hibernate.impl.StatelessSessionImpl.get(StatelessSessionImpl.java:145)
--
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
12 years, 11 months
[Hibernate-JIRA] Created: (HHH-5348) java.lang.IllegalArgumentException: Cannot create TypedQuery for query with more than one return with AbstractEntityManager.createQuery(String jpaqlString, Class<T> resultClass) on View object
by nodje (JIRA)
java.lang.IllegalArgumentException: Cannot create TypedQuery for query with more than one return with AbstractEntityManager.createQuery(String jpaqlString, Class<T> resultClass) on View object
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-5348
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5348
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.5.3
Reporter: nodje
I'm getting a
java.lang.IllegalArgumentException: Cannot create TypedQuery for query with more than one return
with a query that returns a View object.
AbstractEntityManager:279, detects as many returns type as there is parameters in the View object, instead of one single result type, the View Object itself.
QueryString example that fails with public <T> TypedQuery<T> createQuery(String jpaqlString, Class<T> resultClass):
"select new WorkContractDto(wc.workContractStartDate, wc.workContractEndDate, wc.workContractEmployeeLastName, wc.workContractSendingStatus) from WorkContract wc where wc.workContractEmployeeLastName = ?1"
--
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
12 years, 11 months
[Hibernate-JIRA] Created: (HHH-5368) Not throwing Optimistic Lock when the entity is attached
by Fernando Rubbo (JIRA)
Not throwing Optimistic Lock when the entity is attached
--------------------------------------------------------
Key: HHH-5368
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5368
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.2.4.sp1
Environment: windows XP, jboss 4.3 EAP, hibernate 3.4.2.sp1
Reporter: Fernando Rubbo
Priority: Minor
Hi
Hibernate is not throwing Optimistic Lock when the entity is attached. It happens when the business rule sets a version in the attached entity that is less than its original (from database) version value.
Take the following code as an example of the bug.
// inserts A
A a1 = new A();
a1.setName("A1");
dao.persist(a1);
dao.flush();
dao.clear();
// as expected, the piece of code below works just fine
final A a2 = dao.find(A.class, new BigDecimal(1));
a2.setName("A2");
dao.merge(a2);
dao.flush();
dao.clear();
// as expected, this code fails due to Optimistic Lock
try{
final A a3 = dao.find(A.class, new BigDecimal(1));
dao.clear();
a3.setName("A3");
a3.setVersion(0); //database verison is 1
dao.merge(a3);
dao.flush();
Assert.fail();
}catch (Exception e) {
System.out.println(e.getMessage());
// ignore
}finally{
dao.clear();
}
// unexpectedly, the piece of code below also works..
// even with the version being less than the one in the database
// Note that this happens because hibernate is holding internaly the original version of the entity.
// Even when the version is manually changed it keeps using the original one.
final A a3 = dao.find(A.class, new BigDecimal(1));
a3.setName("A3");
a3.setVersion(0); //database verison is 1
dao.merge(a3);
dao.flush();
dao.clear();
This problem can be handled by the business rule. For example, whether the version that comes from the screen is smaller than the one from the database it could throw an Optimistic Lock exception. However, it it was not handled, hibernate must take care of this in the same way it does with detached objects.
--
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
12 years, 11 months
[Hibernate-JIRA] Created: (HHH-6544) Auditing not working for @ManyToMany and @OneToMany with Association table
by chetan verma (JIRA)
Auditing not working for @ManyToMany and @OneToMany with Association table
--------------------------------------------------------------------------
Key: HHH-6544
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6544
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.6.6
Environment: MySql 5.5
Reporter: chetan verma
Below are my entities, table for auditing are created for user,destinies and user.securityGroups relationships, but there is no audit logs for the same with release Hibernate 3.6.6.
But these things are working fine with 3.6.0.
@Entity
@Audited
public class User {
@Id
@GeneratedValue
private int id;
@Column(nullable=false)
private String name;
@OneToMany(cascade=CascadeType.ALL, orphanRemoval=true)
private Set<Destiny> destinies;
@ManyToMany
@JoinTable(joinColumns = @JoinColumn(name = "User_id"), inverseJoinColumns = @JoinColumn(name = "securityGroups_id"), uniqueConstraints = @UniqueConstraint(columnNames = {
"User_id", "securityGroups_id" }))
private Set<SecurityGroup> securityGroups;
}
@Entity
@Audited
public class Destiny {
@Id
@GeneratedValue
private int id;
@Column(nullable=false)
private String name;
}
@Entity
@Audited
public class SecurityGroup {
@Id
@GeneratedValue
private int id;
@Column(nullable=false)
private String name;
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 11 months