[Hibernate-JIRA] Created: (HHH-2097) LAZY property results in org.hibernate.TransientObjectException after merge
by Reto Urfer (JIRA)
LAZY property results in org.hibernate.TransientObjectException after merge
---------------------------------------------------------------------------
Key: HHH-2097
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2097
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.0.cr4
Environment: Hibernate3.2 cr4 with Annotations cr2 and EntityManager cr2, Oracle10g R2, WindowsXP
Reporter: Reto Urfer
Priority: Critical
Attachments: BugLazyPropertyMerge.zip
Entity1 has a property e2 which references Entity2. This property is defined as follows.
@ManyToOne(fetch = FetchType.LAZY, optional = false)
private Entity2 e2;
If you have an instance e1 of Entity1 which has not initialized property e2 and you merge e1 to the EntityManager within a transaction, then you get the following exception during commit:
Exception in thread "main" javax.persistence.RollbackException: Error while commiting the transaction
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:63)
at com.test.Test.main(Test.java:42)
Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.test.Entity1.e2 -> com.test.Entity2
at org.hibernate.engine.CascadingAction$9.noCascade(CascadingAction.java:350)
at org.hibernate.engine.Cascade.cascade(Cascade.java:139)
at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:130)
at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:121)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:53)
... 1 more
I added a small Testproject to reproduce this bug.
--
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, 1 month
[Hibernate-JIRA] Created: (HBX-1042) Make DocHelper robust against failing buildSettings()
by Arnout Engelen (JIRA)
Make DocHelper robust against failing buildSettings()
-----------------------------------------------------
Key: HBX-1042
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1042
Project: Hibernate Tools
Issue Type: Improvement
Components: hbm2doc
Reporter: Arnout Engelen
Attachments: dochelper.diff.txt
DocHelper calls cfg.buildSettings(). to get the Dialect, default catalog name and default schema name.
However, cfg.buildSettings() may fail with a HibernateException (example below).
It would be nice to have DocHelper handle this more gracefully. Attached is a simple patch that does this.
(background: I'd like to use the Configuration I'm getting from a Spring LocalSessionFactoryBean, which after initial creation leaves its LocalDataSourceConnectionProvider in a state that yiels a HibernateException when calling 'configure()' on it, which buildSettings() does. Because of this issue, I cannot use the DocExporter for my Spring-based hibernate configurations)
--
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, 1 month
[Hibernate-JIRA] Created: (HSEARCH-115) Add a default value for indexing null value
by Julien Brulin (JIRA)
Add a default value for indexing null value
-------------------------------------------
Key: HSEARCH-115
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-115
Project: Hibernate Search
Issue Type: Improvement
Components: mapping
Reporter: Julien Brulin
Hi,
Null elements are not indexed by lucene then it's not easy to use a nullable property in lucene query.
I have a TagTranslation entity in my model with a nullable property language. In this case null is used as default language for tag translation.
Each translation may have many variations like synonyms.
Because I can specified a default value for null value in the @Field annotation like this @Field(index=Index.UN_TOKENIZED, store=Store.NO, default='null'), i can't search a cat tag with a default translation like this : +value:cat* +lang:null
<pre></code>
@Entity()
@Table(name="indexing_tag_trans")
@org.hibernate.annotations.Cache(usage=org.hibernate.annotations.CacheConcurrencyStrategy.READ_WRITE)
@Indexed
public class TagTranslation implements java.io.Serializable {
private static final long serialVersionUID = -1065316566731456110L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@DocumentId
private Integer id;
@Field(index=Index.UN_TOKENIZED, store=Store.NO)
private String language;
@Field(index=Index.TOKENIZED, store=Store.YES)
private String value;
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
@org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
@JoinColumn(name="translation_id")
@IndexedEmbedded
private List<TagVariation> variations = new LinkedList<TagVariation>();
public TagTranslation() { }
...
</code>
</pre>
What do you think about that ?
Ps: sorry for english write, i am a french guy.
--
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, 1 month
[Hibernate-JIRA] Created: (ANN-668) Method in entity with return type of ArrayList<Object[]> causes failure to build session factory
by Clint Popetz (JIRA)
Method in entity with return type of ArrayList<Object[]> causes failure to build session factory
------------------------------------------------------------------------------------------------
Key: ANN-668
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-668
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.0.ga
Environment: Hibernate 3.2.X, no database needed (happens during factory build before connecting to db)
Reporter: Clint Popetz
Attachments: propertyTypeExtractorBug.tar.gz
The following source:
@javax.persistence.Entity
public class TestEntity {
@javax.persistence.Id
public int Id;
public java.util.ArrayList<Object[]> badMethod() { return null; }
public static void main(String args[]) {
new org.hibernate.cfg.AnnotationConfiguration().addAnnotatedClass(TestEntity
.class).configure().buildSessionFactory();
}
}
will cause:
java.lang.IllegalArgumentException: No PropertyTypeExtractor available for type void
at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.toXType(JavaReflectionManager.java:164)^M
at org.hibernate.annotations.common.reflection.java.JavaXMethod.create(JavaXMethod.java:18)
at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.getXMethod(JavaReflectionManager.java:128)
at org.hibernate.annotations.common.reflection.java.JavaXClass.getDeclaredMethods(JavaXClass.java:114)
at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:214)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:133)
at org.hibernate.validator.event.ValidateEventListener.initialize(ValidateEventListener.java:91)
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:356)
at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1304)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
Changing the return type to List<Object[]> avoids the bug.
Attached is a tgz of an ant-buildable project; typing "ant run" will illustrate the bug.
--
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