[
http://opensource.atlassian.com/projects/hibernate/browse/EJB-409?page=co...
]
Markus Merder commented on EJB-409:
-----------------------------------
Hardy,
did you rename this issue based on my last comment? I think it would be better to open a
new issue (or relate to EJB-382) leave the description as it was and optionally mark it as
won't fix, because the main discussion was about entities which have no unsaved-value
(@GeneratedValue) and thus cannot be determined as detached. Leaving it as it is could
avoid future discussions relating the same issue.
And what do you think about my suggestion not to cascade persist to detached objects?
Regards,
Markus
Persisting a detached entity as part pf Cascade.PERSIST should throw
EntityExistsException
------------------------------------------------------------------------------------------
Key: EJB-409
URL:
http://opensource.atlassian.com/projects/hibernate/browse/EJB-409
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.2.1
Reporter: Anthony Patricio
Attachments: HBCoreTestCase.zip, HEMTestCase.zip
I didn't really know where to log this extremely weird bug.
Customer 1--* Contact
Bidirectional.
Collection annotated with
@OneToMany(fetch=FetchType.EAGER, mappedBy="customer")
@Cascade({CascadeType.PERSIST})
Step 1: load a Customer (contacts are transparently retrieved) and detach the graph.
Step 2: re attach using session.update
--> session tries to insert into CONTACT table
Weird things:
- works with @OneToMany(fetch=FetchType.LAZY, mappedBy="customer")
- works if CascadeType.PERSIST is removed
- works with 100% plain hibernate (mapping files + session APIs (via session Factory, see
test based on hb core template)
- fails with 50% plain hibernate (mapping files + EM APIs to obtain HB session)
- I also tried to use HEM + hb plain mapping files --> this is failing, that's why
I raised the issue in HEM project.
I'm attaching 2 testcases: one using HEM test template (failing test) and one using
HB Core template (passing test).
This use case is not so exotic and the problem may hide something more critical.
--
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