[Hibernate-JIRA] Created: (HSEARCH-386) In a Transaction, Delete on unindexed entities referenced by indexed entities with ContainedIn throw LazyInitializationException
by Grégoire Rolland (JIRA)
In a Transaction, Delete on unindexed entities referenced by indexed entities with ContainedIn throw LazyInitializationException
--------------------------------------------------------------------------------------------------------------------------------
Key: HSEARCH-386
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-386
Project: Hibernate Search
Issue Type: Bug
Affects Versions: 3.1.1.GA, 3.1.0.GA
Environment: Hibernate 3.3.1.GA, PostgreSQL 8.3
Reporter: Grégoire Rolland
Priority: Critical
Attachments: hsearch.tar.gz
Delete on unindexed entities referenced by indexed entities with ContainedIn annotation failed.
On PostCommit Transaction, I get a LazyInitializationException on the collection with the ContainedIn annotation.
I upload a test case to reproduce this, run the Boot class.
1/ Entity2 is not lacking @DocumentId, I read the doc again and again (my english is very poor, but ...) : "In fact since the 3.1.0 release of Hibernate Search @DocumentId is optional in the case where an @Id annotation exists."
2/ Entity2 is not lacking @IndexedEmbedded, see the "entity1" association.
3/ From Hibernate Entity Manager Doc : "In an EXTENDED persistence context, all read only operations of the entity manager can be executed outside a transaction (find(), getReference(), refresh(), and read queries). Some modifications operations can be executed outside a transaction, but they are queued until the persistence context join a transaction. This is the case of persist(), merge(), remove(). Some operations cannot be called outside a transaction: flush(), lock(), and update/delete queries.". This is the case of the attached test. I attach a second testcase with all the operation in a transaction, the result is the same.
4/ I check 3.1.1-GA, the problem occurs alway.
5/ All the operation are in a transaction.
Please read and run my testcase and if I missuse hibernate say me where.
I can't reopen the bug HSEARCH-342, I open a new bug because the resolution of the bug HSEARCH-178 don't resolve this problem.
Thank you.
--
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, 6 months
[Hibernate-JIRA] Created: (HHH-2295) entity-name attribute's syntax not clearly documented
by Jeremy Michael Crosbie (JIRA)
entity-name attribute's syntax not clearly documented
-----------------------------------------------------
Key: HHH-2295
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2295
Project: Hibernate3
Type: Bug
Components: documentation
Versions: 3.2.1
Environment: Windows XP/JDK 1.5/HypersonicSQL
Reporter: Jeremy Michael Crosbie
Priority: Minor
Attachments: Group.hbm.xml
Setting entity-name to a value containing a hyphen, in my case 'lender-group' causes odd behaviors seemingly only when calling get() or load(). Also in my case I am mapping a class to two different tables (attached). The first mapping has an entity name with a hyphen, the other does not. When I call load *after committing a transaction where a new entity is persisted* I get an exception (see below). The exception complains of a column called "LENDER" not existing. But once I change the entity-name to something like 'lendergroup' the problem goes away. Interestingly, the missing column complained about is the text before the hyphen, so if I name the entity 'lndr-group' it complains of a column name 'LNDR' not existing.
It almost appears if this format is assuming some sort of discriminator, but the online docs are terse when it comes to describing the entity-name field.
Exception:
org.hibernate.exception.SQLGrammarException: could not load an entity: [lender-group#G9]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1799)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:47)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:41)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2730)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:862)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:799)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
at $Proxy0.get(Unknown Source)
at com.fares.mtrac.group.GroupDaoImpl.findById(GroupDaoImpl.java:148)
at com.fares.mtrac.group.GroupDaoImplTest.testFindByIdStringCompanyType(GroupDaoImplTest.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.sql.SQLException: Column not found: LENDER in statement [select lender-gro0_.group_cd as group1_48_0_, lender-gro0_.group_nm as group2_48_0_, lender-gro0_.user_nm as user3_48_0_ from lender_group_name lender-gro0_ where lender-gro0_.group_cd=?]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:442)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:368)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:105)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1785)
... 36 more
--
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, 6 months
[Hibernate-JIRA] Created: (HSEARCH-211) SharedReaderProvider: should own lock when testing for index state
by Sanne Grinovero (JIRA)
SharedReaderProvider: should own lock when testing for index state
------------------------------------------------------------------
Key: HSEARCH-211
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-211
Project: Hibernate Search
Issue Type: Bug
Components: directory provider
Reporter: Sanne Grinovero
Developing a new IndexReader I made a stress-test to compare performance to base readers, but got this when measuring SharedReaderProvider:
Exception in thread "pool-2-thread-13" org.apache.lucene.store.AlreadyClosedException: this IndexReader is closed
at org.apache.lucene.index.IndexReader.ensureOpen(IndexReader.java:163)
at org.apache.lucene.index.DirectoryIndexReader.isCurrent(DirectoryIndexReader.java:149)
at org.hibernate.search.reader.SharedReaderProvider.openReader(SharedReaderProvider.java:83)
at org.hibernate.search.query.FullTextQueryImpl.buildSearcher(FullTextQueryImpl.java:486)
at org.hibernate.search.query.FullTextQueryImpl.getResultSize(FullTextQueryImpl.java:528)
at org.hibernate.search.test.reader.performance.SearchActivity.doAction(SearchActivity.java:24)
at org.hibernate.search.test.reader.performance.AbstractActivity.run(AbstractActivity.java:54)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
--
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, 6 months
[Hibernate-JIRA] Created: (HSEARCH-305) Hibernate search doesn't work with criteria when it is not initialized laziily
by prabhu lal (JIRA)
Hibernate search doesn't work with criteria when it is not initialized laziily
------------------------------------------------------------------------------
Key: HSEARCH-305
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-305
Project: Hibernate Search
Issue Type: Bug
Components: query
Affects Versions: 3.0.1.GA
Environment: MYSQL,HIBERNATE 3.0 , Flex with dpHibernate
Reporter: prabhu lal
Attachments: QueryLoader.java
For the RIA applications complete object tree should be initialized(To achieve that there is work around available like dpHibernate). But hibernate search doesn't apply criteria to queried result because it returns the result on the basis of wether objectt is intialized by loading the criteria objects.Since there is no lazy intiaialization so all the objects are loaded andcomplete result will be return irrespctive of criteria.
code snipet from Hibernate Search API(org.hibernate.search.engine.QueryLoader.java.):
public List load(EntityInfo... entityInfos) {
final int maxResults = entityInfos.length;
if ( maxResults == 0 ) return EMPTY_LIST;
if ( entityType == null ) throw new AssertionFailure( "EntityType not defined" );
if ( criteria == null ) criteria = session.createCriteria( entityType );
DocumentBuilder builder = searchFactoryImplementor.getDocumentBuilders().get( entityType );
String idName = builder.getIdentifierName();
int loop = maxResults / MAX_IN_CLAUSE;
boolean exact = maxResults % MAX_IN_CLAUSE == 0;
if ( !exact ) loop++;
Disjunction disjunction = Restrictions.disjunction();
for (int index = 0; index < loop; index++) {
int max = index * MAX_IN_CLAUSE + MAX_IN_CLAUSE <= maxResults ?
index * MAX_IN_CLAUSE + MAX_IN_CLAUSE :
maxResults;
List ids = new ArrayList( max - index * MAX_IN_CLAUSE );
for (int entityInfoIndex = index * MAX_IN_CLAUSE; entityInfoIndex < max; entityInfoIndex++) {
ids.add( entityInfos[entityInfoIndex].id );
}
disjunction.add( Restrictions.in( idName, ids ) );
}
criteria.add( disjunction );
criteria.list(); //load all objects
//mandatory to keep the same ordering
List result = new ArrayList( entityInfos.length );
for (EntityInfo entityInfo : entityInfos) {
Object element = session.load( entityInfo.clazz, entityInfo.id );
if ( Hibernate.isInitialized( element ) ) { //This is true for all the objects,in case objects are eagrly intialized
//all existing elements should have been loaded by the query,
//the other ones are missing ones
result.add( element );
}
}
return result;
}
--
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, 6 months