[Hibernate-JIRA] Created: (ANN-725) @OneToOne: optional = true is ignored
by Adrian Moos (JIRA)
@OneToOne: optional = true is ignored
-------------------------------------
Key: ANN-725
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-725
Project: Hibernate Annotations
Issue Type: Bug
Components: binder
Affects Versions: 3.3.0.ga
Environment: hibernate 3.2.4.sp1
Reporter: Adrian Moos
Priority: Minor
In some entity, I map:
@javax.persistence.OneToOne(targetEntity = InfoAutoVerrechnungImpl.class, fetch = FetchType.LAZY, //
optional = true)
@javax.persistence.JoinColumns(/**/{
@javax.persistence.JoinColumn(name = "MI0153A", referencedColumnName = "MI0153A", //
nullable = false, updatable = false, insertable = false),
@javax.persistence.JoinColumn(name = "MI1997A", referencedColumnName = "MI1997A", //
nullable = false, updatable = false, insertable = false) })
public InfoAutoVerrechnung getInfoAutoVerrechnung();
The optional = true is lost during construction of hibernate's configuration metamodel, as the property is represented using a ManyToOneType (!) with ignoreNotFound == false (and hence nullable == false). Consequently, hibernate installs a proxy for the property on entity load even if the remote end of the association does not exist (whose lazy initialization fails with an ObjectNotFoundException).
Expected behavior: Hibernate should either respect the optional = true, or throw a MappingException (ideally mentioning the expected way to express nullability).
Workaround: Adding
@NotFound(action = NotFoundAction.IGNORE)
causes hibernate to treat the property as nullable.
--
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-3043) Map in entities using @GenericGenerator(name="system-uuid", strategy = "uuid") doesn't work
by Pascal P. Pochet (JIRA)
Map in entities using @GenericGenerator(name="system-uuid", strategy = "uuid") doesn't work
-------------------------------------------------------------------------------------------
Key: HHH-3043
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3043
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.5
Reporter: Pascal P. Pochet
Priority: Blocker
Attachments: Archive.zip
When using this entity declaration
@Id
@GeneratedValue
protected long id ;
@Type(type="language")
@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
@MapKey(columns=@Column(name="language", length=6))
protected java.util.Map<Language,Label> itsLabels = new HashMap<Language,Label>() ;
reading back of persisted Label associated with the entity works ok
When changing to
@Id
@GenericGenerator(name="system-uuid", strategy = "uuid")
@Column(name="id", length=36)
protected String itsUUID = UUID.randomUUID().toString() ;
@Type(type="language")
@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
@MapKey(columns=@Column(name="language", length=6))
protected java.util.Map<Language,Label> itsLabels = new HashMap<Language,Label>() ;
persisted Label can't be retrieved anymore (the itsLabels Map is always empty) and persisting new version of existing labels generates duplicate errors (of course...).
Tracking down the problem shows that different code is executed when the LAZY loading the map is performed, the UUID-based version generating the reading of 4 times the same Collection (there were 3 Label persisted for the test entity) and as consequence the setter is not called leaving the Label Map empty (as initialized at constructor time)
Part of the debug trace :
[java] 17:43:03,090 DEBUG CollectionLoadContext:217 - 4 collections were found in result set for role: eu.cec.sanco.sanref.valuelist.Individual.itsLabels
[java] 17:43:03,091 DEBUG CollectionLoadContext:260 - collection fully initialized: [eu.cec.sanco.sanref.valuelist.Individual.itsLabels#ac7117a2-3c0c-4d40-90ba-3bef5a5c77eb]
[java] 17:43:03,091 DEBUG CollectionLoadContext:260 - collection fully initialized: [eu.cec.sanco.sanref.valuelist.Individual.itsLabels#ac7117a2-3c0c-4d40-90ba-3bef5a5c77eb]
[java] 17:43:03,092 DEBUG CollectionLoadContext:260 - collection fully initialized: [eu.cec.sanco.sanref.valuelist.Individual.itsLabels#ac7117a2-3c0c-4d40-90ba-3bef5a5c77eb]
[java] 17:43:03,092 DEBUG CollectionLoadContext:260 - collection fully initialized: [eu.cec.sanco.sanref.valuelist.Individual.itsLabels#ac7117a2-3c0c-4d40-90ba-3bef5a5c77eb]
[java] 17:43:03,093 DEBUG CollectionLoadContext:226 - 4 collections initialized for role: eu.cec.sanco.sanref.valuelist.Individual.itsLabels
[java] 17:43:03,093 DEBUG StatefulPersistenceContext:790 - initializing non-lazy collections
[java] 17:43:03,094 DEBUG Loader:2010 - done loading collection
while on the Long id-based entity we got :
[java] 18:09:27,800 DEBUG CollectionLoadContext:217 - 1 collections were found in result set for role: eu.cec.sanco.sanref.valuelist.Individual.itsLabels
[java] 18:09:27,801 DEBUG CollectionLoadContext:260 - collection fully initialized: [eu.cec.sanco.sanref.valuelist.Individual.itsLabels#299]
[java] 18:09:27,801 DEBUG CollectionLoadContext:226 - 1 collections initialized for role: eu.cec.sanco.sanref.valuelist.Individual.itsLabels
[java] 18:09:27,802 DEBUG StatefulPersistenceContext:790 - initializing non-lazy collections
[java] 18:09:27,802 DEBUG Loader:2010 - done loading collection
Also in the trace of the UUID-based version, we see that Hibernate recursively load the mapped entity (Label)
[java] 17:43:02,906 DEBUG Loader:1852 - loading entity: [eu.cec.sanco.sanref.Label#0199f151-44f7-4704-9f09-72a42527590c]
(one "loading entity" message per persisted Label...)
while this is not happening when running the "GeneratedValue" version.
NB
The problem is not related to the usage of the UserType Language, testing as been done by going back to a more basic <String,Label> map: the problem remains identical.
By stepping in the code, possible source of the problem may be related to the "hasRowId" returned value in the UUID-based version. (not 100% sure...)
The 2 log files attached in 1 zip show the differences when lazy loading the Label map.
--
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-2119) reloading a detached object with a collection fails
by Gregory Kotsaftis (JIRA)
reloading a detached object with a collection fails
---------------------------------------------------
Key: HHH-2119
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2119
Project: Hibernate3
Type: Bug
Versions: 3.1.3
Environment: Hibernate 3.1.3
firebird 1.5.3.4870 with Jaybird-2.1.0
java 1.5.0_07
Reporter: Gregory Kotsaftis
Hi,
1) I have a simple object <O> with a collection loaded and use <version> for both (no second level cache)
2) The object <O> is associated with session A, via <O> = load(CLASS, <ID>)
3) The session <A> is later closed because e.g. an exception occurs
4) Another session is opened later on, session B
5) If load(<O>, <ID>) is called an NonUniqueObjectException is thrown
(a different object with the same identifier value was already associated with the session)
6) If instead I use the session.refresh(<O>) no exception is thrown, the object is reloaded ok.
It seems this issue might be related with:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-511
but i cannot be sure.
Part of the stacktrace:
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [gr.metadata.orthomed.db.Patient#23]
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:132)
at org.hibernate.event.def.DefaultLoadEventListener.returnNarrowedProxy(DefaultLoadEventListener.java:202)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:169)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:862)
at org.hibernate.impl.SessionImpl.load(SessionImpl.java:770)
at gr.metadata.lib.hibernate.HibernateHelper.reloadObject(HibernateHelper.java:230)
--
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-2605) Since 3.2.4 no value specified for row id
by Igor A Tarasov (JIRA)
Since 3.2.4 no value specified for row id
-----------------------------------------
Key: HHH-2605
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2605
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.4
Environment: hibernate-3.2.4
mysql-5.0.27-1.fc6
mysql-connector-java-5.0.5-bin.jar
Reporter: Igor A Tarasov
Problem starts in 3.2.4 version, but in 3.2.3 was all right.
Row ID column is specified as parameter in query, but no value is specified.
Row ID column is autoincrement in MySQL tabled.
10.05.07 14:26:29 DEBUG [btpool0-0]: SQL - insert into PaymentDO (_version, comment, created, customer_id, nalichka, newBalance, payDate, sum, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
10.05.07 14:26:29 TRACE [btpool0-0]: AbstractBatcher - preparing statement
10.05.07 14:26:29 TRACE [btpool0-0]: AbstractEntityPersister - Dehydrating entity: [org.dicr.isp.data.PaymentDO#<null>]
10.05.07 14:26:29 TRACE [btpool0-0]: LongType - binding '0' to parameter: 1
10.05.07 14:26:29 TRACE [btpool0-0]: StringType - binding null to parameter: 2
10.05.07 14:26:29 TRACE [btpool0-0]: TimestampType - binding '2007-05-10 14:26:29' to parameter: 3
10.05.07 14:26:29 TRACE [btpool0-0]: VersionValue - version unsaved-value strategy UNDEFINED
10.05.07 14:26:29 TRACE [btpool0-0]: IdentifierValue - id unsaved-value: 0
10.05.07 14:26:29 TRACE [btpool0-0]: LongType - binding '18128' to parameter: 4
10.05.07 14:26:29 TRACE [btpool0-0]: BooleanType - binding 'false' to parameter: 5
10.05.07 14:26:29 TRACE [btpool0-0]: FloatType - binding '3.0' to parameter: 6
10.05.07 14:26:29 TRACE [btpool0-0]: TimestampType - binding '2007-05-10 00:00:00' to parameter: 7
10.05.07 14:26:29 TRACE [btpool0-0]: FloatType - binding '3.0' to parameter: 8
10.05.07 14:26:29 DEBUG [btpool0-0]: AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
10.05.07 14:26:29 TRACE [btpool0-0]: AbstractBatcher - closing statement
10.05.07 14:26:29 DEBUG [btpool0-0]: JDBCExceptionReporter - could not insert: [org.dicr.isp.data.PaymentDO] [insert into PaymentDO (_version, comment, created, customer_id, nalichka, newBalance, payDate, sum, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)]
java.sql.SQLException: No value specified for parameter 9
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:1674)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1512)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1455)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1440)
at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:73)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:33)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49)
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:213)
at org.dicr.isp.data.HibernateDataManager.createPayment(HibernateDataManager.java:692)
--
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: (HSEARCH-196) ObjectNotFoundException not caught in FullTextSession
by Christian Wiedmann (JIRA)
ObjectNotFoundException not caught in FullTextSession
-----------------------------------------------------
Key: HSEARCH-196
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-196
Project: Hibernate Search
Issue Type: Bug
Components: engine
Affects Versions: 3.0.1.GA
Environment: Hibernate core 3.2.4.sp1, MySQL 5
Reporter: Christian Wiedmann
Priority: Minor
I am getting an ObjectNotFoundException from FullTextSession when running a query with items in the index that have been deleted from the database. It seems like the intent is not to let this exception be thrown, but the stack trace shows the exception is not being caught in ObjectLoader.load when it is thrown from session.get().
ref: http://forum.hibernate.org/viewtopic.php?p=2384677
org.hibernate.ObjectNotFoundException: No row with the given identifier exists:
[com.lawtrust.server.Document#ca533472193932230119394006b0004f]
at org.hibernate.impl.SessionFactoryImpl$1.handleEntityNotFound(SessionFactoryImpl.java:377)
at org.hibernate.event.def.DefaultLoadEventListener.returnNarrowedProxy(DefaultLoadEventListener.java:223)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:187)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
at org.hibernate.search.engine.ObjectLoader.load(ObjectLoader.java:27)
at org.hibernate.search.engine.ProjectionLoader.load(ProjectionLoader.java:54)
at org.hibernate.search.query.FullTextQueryImpl.list(FullTextQueryImpl.java:244)
at com.lawtrust.server.bl.spring.service.impl.SearchServiceImpl.find(SearchServiceImpl.java:94)
--
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-3292) Bug Oracle9iDialect Pagination
by Mizael Montenegro (JIRA)
Bug Oracle9iDialect Pagination
------------------------------
Key: HHH-3292
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3292
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.6
Environment: Java2 6.0, Oracle 10i, Hibernate 3.2.6
Reporter: Mizael Montenegro
Priority: Critical
Hi, I found a flaw in the dialect of the oracle, the pagination doesn't work correctly, my English is terrible, then I cannot describe the complete problem here, more I will post the string sql that solves the problem.
select * from ( SELECT x.*, rownum as r FROM ( "CONSULT SQL" ) x ) where r between ? AND ?
setInt(1, BEGIN);
setInt(2, END);
I altered the dialect and it perfectly worked with that solution. The largest problem is when ordination, the order is used using pagination corresponds never to the exact return of the original consultation.
--
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