[Hibernate-JIRA] Created: (HHH-4975) ManyToOne and referencedColumnName and MappedSuperclass (2 Levels) => org.hibernate.AnnotationException: referencedColumnNames ... not mapped to a single property
by Christian Fritschi (JIRA)
ManyToOne and referencedColumnName and MappedSuperclass (2 Levels) => org.hibernate.AnnotationException: referencedColumnNames ... not mapped to a single property
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-4975
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4975
Project: Hibernate Core
Issue Type: Bug
Components: annotations
Affects Versions: 3.3.2
Environment: Hibernate version 3.3.2.GA, HSQLDB 1.8.0.10
Reporter: Christian Fritschi
Priority: Critical
Attachments: startTestDb.rar, ukMapping.rar, UkMappingTest.java
Level 1 (superClass)
-------
@MappedSuperclass
public abstract class AbstractMasterUk ...
@Id
private int id;
....
@Column(name="MASTER_ID", nullable = false, length=50)
private String masterId;
Level 2 (superClass)
-------
@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@Table(name="MASTER_UK")
@DiscriminatorColumn(name="DOMAIN", discriminatorType=DiscriminatorType.STRING)
public class MasterUkBase extends AbstractMasterUk ....
Parent-Class
------------
@Entity
@org.hibernate.annotations.Entity(mutable = false)
@DiscriminatorValue(MasterUk1.DOMAIN)
public class MasterUk1 extends MasterUkBase ...
Child-Class
-----------
@Entity
@Table(name="DETAIL_UK")
public class DetailUk implements Serializable {
@Id
private int id;
@ManyToOne(optional=false)
@JoinColumn(name="MASTER", nullable=true, referencedColumnName="MASTER_ID")
private MasterUk1 master;
Result:
org.hibernate.AnnotationException: referencedColumnNames(MASTER_ID) of annotations.playground.delta.ukMapping.DetailUk.master referencing annotations.playground.delta.ukMapping.MasterUk1 not mapped to a single property
at org.hibernate.cfg.BinderHelper.createSyntheticPropertyReference(BinderHelper.java:180)
at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:88)
at org.hibernate.cfg.AnnotationConfiguration.processEndOfQueue(AnnotationConfiguration.java:456)
at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:438)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:309)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1333)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
.....
--
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
13 years, 4 months
[Hibernate-JIRA] Created: (HHH-3495) CollectionAction instances can consume considerable memory in large transactions unnecessarily
by Tim Downey (JIRA)
CollectionAction instances can consume considerable memory in large transactions unnecessarily
----------------------------------------------------------------------------------------------
Key: HHH-3495
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3495
Project: Hibernate Core
Issue Type: Improvement
Reporter: Tim Downey
Attachments: CollectionActionPatch.zip
Hi,
We're doing some fairly heavy duty batch processing using Hibernate 3.3.1. In doing so, we're basically paging over large chunks of entities where we flush and clear the session around pages. We do not commit between pages. We may be processing hundreds of thousands of entities over pages of ten to twenty thousand each.
We're clearing the session around pages in attempt to free up memory that is no longer necessary. We have found that subtypes of CollectionAction get added to a list of Executable in the ActionQueue when there are collection changes processed. These CollectionActions are held until transaction complete and are not released on flush or clear of the session.
Furthermore, the CollectionAction instances hold references to those collections that have changed even after the entities have been evicted from the session. In our case, this was causing Hibernation to hold on to several hundred MB of RAM until transaction commit.
I've supplied a small patch that doesn't require the CollectionAction to hang on to the entities themselves until the transaction boundary. We're showing considerably improvement in memory utilization as a result. I'm hoping that you consider this patch for inclusion in a future release.
The change was basically to change the ActionQueue's list of Executables used in after transaction completion, to a separate type, AfterTransactionCompletionExecutable. This new type allows some decoupling in the other subclasses of Executable to hold references to fewer resources and save considerable memory when the transaction sizes are quite large.
Regards,
Tim
--
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
13 years, 4 months
[Hibernate-JIRA] Created: (HHH-2169) L2 Cache and Long transactions Memory Leak : OutOfMemoryException
by Sami Dalouche (JIRA)
L2 Cache and Long transactions Memory Leak : OutOfMemoryException
-----------------------------------------------------------------
Key: HHH-2169
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2169
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.0.ga
Environment: [b]Hibernate version:[/b]
Hibernate Entity Manager 3.2.0, with Hibernate Core 3.2.0 and Hibernate Annotations 3.2.0
[b]Mapping documents:[/b]
Annotations
[b]Full stack trace of any exception that occurs:[/b]
Memory Heap Exception
[b]Name and version of the database you are using:[/b]
PosgreSQL 8.1
Reporter: Sami Dalouche
Summary
---------
When enabling L2 Cache (with either OScache and EhCache, both with a limitation on the max #of instances, so the problem shouldn't come from the cache manager), Hibernate cannot have long running transactions, otherwise, it results in a Memory Heap Exception...
The problem does NOT happen if the L2 Cache is disabled !
Details
----------
- Configure the code to run in ONE transaction
- Have a huge loop that inserts 2 million entries that are cacheable (@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE))
- flush() and clear() every 1000 entries, to periodically flush the cache
=> None of the entries are garbage collected.
=> Using a profiler, it is possible to trace the owning objects of my domain classes to :
- org.hibernate.action.EntityInsertAction ("instance" variable)
- array / List (variable elementData)
- variable "executions" in object .. class org.hibernate.engine.ActionQueue
Remarks :
- If the Query Cache is disabled, and the objects being inserted are NOT cacheable (no @Cache annotation), there is no problem
- If the Query Cache is enabled, then, no matter whether the objects being inserted are cacheable or not, The entries are never garbage collected, and I get an OutOfMemoryException. (I see NO relationship between the Query Cache and my objects. I never query the objects, only save them !!)
--
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
13 years, 4 months
[Hibernate-JIRA] Created: (HHH-2735) Query . setLockMode cannot find the alias when the query defines a select clause
by Tamir Solomon (JIRA)
Query . setLockMode cannot find the alias when the query defines a select clause
--------------------------------------------------------------------------------
Key: HHH-2735
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2735
Project: Hibernate3
Issue Type: Bug
Reporter: Tamir Solomon
I tried to perform the following :
Query q1 = session.createQuery("select serverIP.server from ServerIP serverIP where serverIP.ip = :ipStr");
q1.setLockMode("serverIP",LockMode.NONE);
q1.setParameter("ipStr", ip);
q1.list();
and i get this error :
Frame : java.lang.IllegalArgumentException: alias not found: serverIP
at org.hibernate.loader.hql.QueryLoader.applyLocks(QueryLoader.java:299)
at org.hibernate.loader.Loader.preprocessSQL(Loader.java:189)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1529)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2211)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
at org.hibernate.loader.Loader.list(Loader.java:2090)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:388)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
--
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
13 years, 5 months
[Hibernate-JIRA] Created: (HHH-4582) Repeated column in mapping for entity in composite id
by Franck Bisti (JIRA)
Repeated column in mapping for entity in composite id
-----------------------------------------------------
Key: HHH-4582
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4582
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: Hibernate 3.3.1
Reporter: Franck Bisti
Priority: Minor
Attachments: PersistentClass.java
I have a composite-id with 2 manytoone. The two manytoone are composed by 3 columns each. They share 2 columns.
@Embeddable
public class FooBarId implements Serializable {
@ManyToOne()
@JoinColumns({
@JoinColumn(name="FOO_BAR1", referencedColumnName="FOO_BAR1",nullable=false, updatable=true, insertable=true),
@JoinColumn(name="FOO_BAR2", referencedColumnName="FOO_BAR2",nullable=false, updatable=true, insertable=true),
@JoinColumn(name="FOO_ID", referencedColumnName="ID",nullable=false, updatable=true, insertable=true)
})
private Foo foo;
/** Attribute*/
@ManyToOne()
@JoinColumns({
@JoinColumn(name="FOO_BAR1", referencedColumnName="FOO_BAR1",nullable=false, updatable=false, insertable=false),
@JoinColumn(name="FOO_BAR2", referencedColumnName="FOO_BAR2",nullable=false, updatable=false, insertable=false),
@JoinColumn(name="BAR_ID", referencedColumnName="ID",nullable=false, updatable=false, insertable=false)
})
private Bar bar;
Exception :
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: com.test.FooBar column: FOO_BAR2 (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:670)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:711)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:468)
at org.hibernate.mapping.RootClass.validate(RootClass.java:215)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1135)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1320)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:854)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
I have the "Repeated column in mapping" exception because Hibernate doesn't use the insertable and updtable property in the PersistentClass.checkColumnDuplication for composite-id.
I have modified the PersistentClass.checkColumnDuplication() by use of getColumnUpdateability code and it seems to works fine (see attached file)
I don't know if that can help
--
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
13 years, 5 months
[Hibernate-JIRA] Created: (HHH-3361) LazyInitializationException generate an error message in the logs
by benoit heinrich (JIRA)
LazyInitializationException generate an error message in the logs
-----------------------------------------------------------------
Key: HHH-3361
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3361
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.3.0.CR1
Reporter: benoit heinrich
Priority: Minor
Hi,
When a LazyInitializationException is thrown a log message is automatically created by the exception class because of the line 19 in the LIE class:
LoggerFactory.getLogger( LazyInitializationException.class ).error( msg, this );
An exception should not write log messages, this is part of the application that handle the exception that should decide either or nor a log message should be created.
The exception should just carry all information with it and no more.
Actually this is causing a serious problem to one of the application I'm working on because LIE is a normal exception and is caught and handled correctly and each time a LIE is thrown by hibernate I'm getting a full stack trace in the logs (which is wrong in my case because the exception is handled correctly).
Also I don't want to change the log4j settings to ignore the LIE because I'd like to know when I get a LIE that is not caught.
So my suggestion is to simply remove the Log entry from the LIE constructor since normally this message is anyway redundant because if the exception is not caught the application will dump the exception in most of the time.
Cheers,
/Benoit
--
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
13 years, 5 months