[Hibernate-JIRA] Created: (EJB-409) EAGER fetched collection + Cascade.PERSIST generates broken behavior on session.update
by Anthony Patricio (JIRA)
EAGER fetched collection + Cascade.PERSIST generates broken behavior on session.update
--------------------------------------------------------------------------------------
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
17 years, 1 month
[Hibernate-JIRA] Commented: (HHH-1483) MySQL5: No Dialect mapping for JDBC type: -1
by Juan Carlos Valverde (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1483?page=c... ]
Juan Carlos Valverde commented on HHH-1483:
-------------------------------------------
I had to modify the code to include
registerColumnType(Types.LONGVARCHAR, Hibernate.STRING.getName());
because I kept getting the same error. In my case both registrations are required.
> MySQL5: No Dialect mapping for JDBC type: -1
> --------------------------------------------
>
> Key: HHH-1483
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1483
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1.2
> Environment: MySQL 5.0.18-nt
> Reporter: Sergey Vladimirov
> Priority: Minor
> Attachments: hhh-1483-patch.txt
>
>
> MySQL5: No Dialect mapping for JDBC type: -1
> SELECT answpos,answer FROM votes_answers WHERE question=? ORDER BY answpos
> mysql> describe votes_answers;
> +----------+---------+------+-----+---------+-------+
> | Field | Type | Null | Key | Default | Extra |
> +----------+---------+------+-----+---------+-------+
> | question | int(11) | NO | MUL | | |
> | answpos | int(11) | NO | | | |
> | answer | text | YES | | NULL | |
> +----------+---------+------+-----+---------+-------+
> mysql> describe temp;
> +---------+---------+------+-----+---------+-------+
> | Field | Type | Null | Key | Default | Extra |
> +---------+---------+------+-----+---------+-------+
> | answpos | int(11) | NO | | 0 | |
> | answer | text | YES | | NULL | |
> +---------+---------+------+-----+---------+-------+
> Please, let me know what to add to MySQL5Dialect :)
> Will it be ok to add? :
> registerColumnType( Types.LONGVARCHAR, "text" );
--
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, 1 month
[Hibernate-JIRA] Commented: (HHH-1725) lazy properties, events and collection xxx was not processed by flush exception and EJB3 incompatibility
by Chris Brown (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1725?page=c... ]
Chris Brown commented on HHH-1725:
----------------------------------
I ran into this issue when using Hibernate Validator. The way I worked around it is to do the validation on the FlushEntityEvent, instead of on the PreUpdateEvent. Initializing lazily loaded collections from this event handler seems to be ok. If your validation code executes any queries you may want to temporarily disable auto-flushing to avoid your flush entity listener being called recursively.
> lazy properties, events and collection xxx was not processed by flush exception and EJB3 incompatibility
> --------------------------------------------------------------------------------------------------------
>
> Key: HHH-1725
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1725
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.2.0.cr2
> Reporter: Tomasz Bech
>
> It is realted to anomaly: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1540
> 'When using custom event listeners, sometimes you mess with (and initialize) lazy collections by mistake, which causes CollectionEntry.postFlush(PersistentCollection) to throw an AssertionFailure'
> It is questionable why AT ALL exception is raised in this case!
> What is the most important: EJB3 spec is not prohibiting to check/read/ object involved in the event, so current implementation is agains EJB3 spec.
> Events are often used for validation so it is quite probable that the lazy property (collection) has to be accessed - and when it is lazy and not initialized before the exception is raised. Why hibernate cannot treat it in nicer way and allow such actions.
> One workaround is to not-use-lazy (very bad).
> Second workaround: in the code outside flush (not in event) pre-initialize all lazy properties (in fact simulation of 'not-lazy).
--
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, 1 month