[Hibernate-JIRA] Created: (ANN-721) ManyToOne Persisting Cascade in Embeddable
by Endre Jeges (JIRA)
ManyToOne Persisting Cascade in Embeddable
------------------------------------------
Key: ANN-721
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-721
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.1.GA
Environment: Java version:
java version "1.6.0_04"
Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)
Oracle Version:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
PL/SQL Release 9.2.0.8.0 - Production
"CORE 9.2.0.8.0 Production"
TNS for Linux: Version 9.2.0.8.0 - Production
NLSRTL Version 9.2.0.8.0 - Production
hibernate: 3.2.6.ga
hibernate-annotations: 3.3.1.ga
hibernate-commons-annotations: 3.3.0.ga
hibernate-entitymanager: 3.3.1.ga
Reporter: Endre Jeges
Attachments: pairTest.zip
Hello,
I have found something that is a bit strange. For @ManyToOne association properties in an @Embeddable class the cascade PERSIST, SAVE-UPDATE option is not working well (not sure for the other cascade types), if the entities associated with ManyToOne are transient. I have created a unit test to check it and I have it attached to this issue. It is a maven2 project, and needs Oracle to run it. If I save the associated entites, then everything works fine, also the data structure is created well.
I have checked the forums and found similar problems, maybe they can help more then my post:
http://forum.hibernate.org/viewtopic.php?t=965238
http://forum.hibernate.org/viewtopic.php?t=976534
http://forum.hibernate.org/viewtopic.php?t=978112
http://forum.hibernate.org/viewtopic.php?t=978138
http://forum.hibernate.org/viewtopic.php?t=983766
http://forum.hibernate.org/viewtopic.php?t=983780
http://forum.hibernate.org/viewtopic.php?t=983868
Details:
@Entity
class CodedPairHolder {
@Id
private Long id;
@Column(name = "CODE", nullable = false, unique = true, updatable = false, length = 256)
private String code;
@CollectionOfElements
@JoinTable(name = "CODED_PAIR_HOLDER_PAIR_SET", joinColumns = @JoinColumn(name = "CODED_PAIR_HOLDER_ID"))
private final Set<PersonPair> pairs = new HashSet<PersonPair>(0);
........ constructors getters equals hashCode
}
@Embeddable
class PersonPair {
@ManyToOne(optional = false, fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH })
@Cascade( { org.hibernate.annotations.CascadeType.PERSIST, org.hibernate.annotations.CascadeType.MERGE, org.hibernate.annotations.CascadeType.REFRESH,
org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.REPLICATE, org.hibernate.annotations.CascadeType.EVICT })
@JoinColumn(name = "LEFT_PERSON_ID", nullable = false, updatable = false)
private Person left;
@ManyToOne(optional = false, fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH })
@Cascade( { org.hibernate.annotations.CascadeType.PERSIST, org.hibernate.annotations.CascadeType.MERGE, org.hibernate.annotations.CascadeType.REFRESH,
org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.REPLICATE, org.hibernate.annotations.CascadeType.EVICT })
@JoinColumn(name = "RIGHT_PERSON_ID", nullable = false, updatable = false)
private Person right;
........ constructors getters equals hashCode
}
@Entity
class Person {
@Id
private Long id;
@Column(name = "NAME", nullable = false, unique = true, updatable = false, length = 256)
private String name;
........ constructors getters equals hashCode
}
The error message is:
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: Person
Regards,
jeges
--
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
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-6984) statistics for transactions are incremented even when stats are disabled
by Scott Marlow (JIRA)
statistics for transactions are incremented even when stats are disabled
------------------------------------------------------------------------
Key: HHH-6984
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6984
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.0.1
Reporter: Scott Marlow
Assignee: Scott Marlow
Fix For: 4.1.0
if we build another 4.0.x, it would be good to fix in that also.
AS7 command line interface showing statistics when they should be disabled:
{quote}
[standalone@localhost:9999 /] /deployment=demo.war/subsystem=jpa/hibernate-persistence-unit=demo.war#loginDatabase:read-resource(include-runtime=true)
{
"outcome" => "success",
"result" => {
"close-statement-count" => 0L,
"collection" => undefined,
"collection-fetch-count" => 0L,
"collection-load-count" => 0L,
"collection-recreated-count" => 0L,
"collection-remove-count" => 0L,
"collection-update-count" => 0L,
"completed-transaction-count" => 7L,
"connect-count" => 7L,
"enabled" => false,
"entity-cache" => undefined,
"entity-delete-count" => 0L,
"entity-fetch-count" => 0L,
"entity-insert-count" => 0L,
"entity-load-count" => 0L,
"entity-update-count" => 0L,
"flush-count" => 0L,
"optimistic-failure-count" => 0L,
"prepared-statement-count" => 7L,
"query-cache" => undefined,
"query-cache-hit-count" => 0L,
"query-cache-miss-count" => 0L,
"query-cache-put-count" => 0L,
"query-execution-count" => 0L,
"query-execution-max-time" => 0L,
"query-execution-max-time-query-string" => undefined,
"second-level-cache-hit-count" => 0L,
"second-level-cache-miss-count" => 0L,
"second-level-cache-put-count" => 0L,
"session-close-count" => 0L,
"session-open-count" => 0L,
"successful-transaction-count" => 6L,
"entity" => {"org.jboss.as.quickstarts.login.User" => undefined}
{quote}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-7010) Document mapping annotations
by Steve Ebersole (JIRA)
Document mapping annotations
----------------------------
Key: HHH-7010
URL: https://hibernate.onjira.com/browse/HHH-7010
Project: Hibernate ORM
Issue Type: Task
Components: annotations, core, documentation
Reporter: Steve Ebersole
Assignee: John Verhaeg
Fix For: 4.1.0
Discuss every annotation in the {{org.hibernate.annotations}} and {{javax.persistence}} packages, one per <section/> such that they show up in TOC. List them in alphabetical order. Possibly segment the JPA and Hibernate annotations into separate sections
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[Hibernate-JIRA] Created: (JPA-27) Problem whith criteria search
by Samuel Rettore (JIRA)
Problem whith criteria search
-----------------------------
Key: JPA-27
URL: http://opensource.atlassian.com/projects/hibernate/browse/JPA-27
Project: Java Persistence API
Issue Type: Bug
Affects Versions: 1.0.0
Reporter: Samuel Rettore
Two criteria to a search and no one uses criteria that works with JPQL criteria does not work seems to be the date field where the comparison does not work.
Criteria- fail
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<SrhaplicacaoSaldo> criteriaQuery = builder.createQuery(SrhaplicacaoSaldo.class);
Root<SrhaplicacaoSaldo> root = criteriaQuery.from(SrhaplicacaoSaldo.class);
criteriaQuery.select(root);
criteriaQuery.where(builder.equal(root.get(SrhaplicacaoSaldo_.idaplicacao).
get(Srhaplicacao_.idaplicacao), idaplicacao),
builder.equal(root.get(SrhaplicacaoSaldo_.dataSaldo), dataSaldo));
criteriaQuery.orderBy(builder.desc(root.get(SrhaplicacaoSaldo_.dataSaldo)),
builder.desc(root.get(SrhaplicacaoSaldo_.idaplicacaosaldo)));
return em.createQuery(criteriaQuery).
setMaxResults(1).
getSingleResult();
JPQ - OK
return (SrhaplicacaoSaldo) em.createQuery("Select a from SrhaplicacaoSaldo a where "
+ "a.idaplicacao.idaplicacao=:idaplicacao and a.dataSaldo=:dtsaldo order by a.dataSaldo,a.idaplicacaosaldo ").
setParameter("idaplicacao", idaplicacao).
setParameter("dtsaldo", dataSaldo).
setMaxResults(1).
getSingleResult();
Tanks.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months