[Hibernate-JIRA] Created: (HHH-3708) Suboptimal exception on m:n relations with an unaudited entity
by Eike Hirsch (JIRA)
Suboptimal exception on m:n relations with an unaudited entity
--------------------------------------------------------------
Key: HHH-3708
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3708
Project: Hibernate Core
Issue Type: Improvement
Components: envers
Affects Versions: 3.3.1
Environment: Hibernate 3.3.1, Envers 3.4-Snapshot, Java 6, Spring 2.5
Reporter: Eike Hirsch
Priority: Minor
The following code will produce a NullPointerException on listener startup when **B** is not audited. The exception should state that there is an audited collection to an unaudited entity. (And for debugging it would be really cool to log both entity class names)
{code}
@ManyToMany( cascade= {CascadeType.ALL} )
public List<B> getBs() {
return bs;
}
{code}
As described in http://www.jboss.com/index.html?module=bb&op=viewtopic&t=148392.
{code}
2009-01-09 16:46:11.872::WARN: Nested in org.springframework.beans.factory.BeanCreationException: E
rror creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicati
onContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateExcepti
on: could not init listeners:
java.lang.NullPointerException
at org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addValueToMiddleTable(Co
llectionMetadataGenerator.java:380)
at org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addWithMiddleTable(Colle
ctionMetadataGenerator.java:303)
at org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addCollection(Collection
MetadataGenerator.java:152)
at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addValue(AuditMetadataGenerat
or.java:136)
at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addProperties(AuditMetadataGe
nerator.java:155)
at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateSecondPass(AuditMetad
ataGenerator.java:343)
at org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:96)
at org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:86)
at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:99)
at org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:232)
at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1338)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactory
Bean.java:814)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFacto
ryBean.java:732)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSession
FactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(A
bstractAutowireCapableBeanFactory.java:1369)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(Abst
ractAutowireCapableBeanFactory.java:1335)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(Abstra
ctAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutow
ireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(Abstract
AutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.ja
va:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingl
etonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java
:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:1
85)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:1
64)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(De
faultListableBeanFactory.java:423)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(A
bstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContex
t.java:380)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255
)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.j
ava:45)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:530)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:161)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
at org.mortbay.jetty.Server.doStart(Server.java:220)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:345)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:286)
at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:204)
at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:183)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:579)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycl
eExecutor.java:498)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycl
eExecutor.java:265)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor
.java:191)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)
at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304)
at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:52)
{code}
--
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
15 years, 7 months
[Hibernate-JIRA] Created: (HHH-3741) Join tables are not audited if the join is defined in an abstract
by David Lilley (JIRA)
Join tables are not audited if the join is defined in an abstract
------------------------------------------------------------------
Key: HHH-3741
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3741
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.4
Environment: JBoss 4.2.3
Seam 2.1
Hibernate 3.4
Envers 3.4
PostgreSQL 8.3
Reporter: David Lilley
Attachments: EnversTest.zip
I have an abstract with a one-to-many relationship to to another abstract. I defined a join table and an audit join table for the one-to-many relationship.
The abstract classes are extended to "Set" and "Item" classes using the joined inheritance type. (Set and Item aren't the real names of course; the names have been scrubbed to protect the innocent.)
The tables and audit tables are all created correctly. When I run my tests, the entities and relationship tables are correctly populated, and the entities' audit tables are populated. However, the audit table for the relationships are empty. (i.e., Item, Item_aud, Set, Set_aud, Set_Item all have the proper data, but Set_Item_aud doesn't have any data.)
I tested a non-abstract class that has a similar one-to-many relationship, using the same hibernate annotations, with the same type of join table and audit join table. When I run my tests, all tables are correctly populated - including the join audit table.
Attached is a complete failing test case, with a SEAM test.
--
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
15 years, 7 months
[Hibernate-JIRA] Created: (HHH-2355) CGLIBLazyInitializer can not access a public member if parent class is not public
by Daniel Beland (JIRA)
CGLIBLazyInitializer can not access a public member if parent class is not public
---------------------------------------------------------------------------------
Key: HHH-2355
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2355
Project: Hibernate3
Type: Bug
Versions: 3.2.1
Reporter: Daniel Beland
In hibernate 3.2.1, CGLIBLazyInitializer cannot acces a public method if it has been inherited from a parent class that is not public.
Let's say we have a class A, modifier = default (package) with a public method getName() (and setName(String name)).
Then I create a public class B that extends A.
in my code I can retrieve B from the database:
B b = session.load(B.class, new Integer(1), LockMode.NONE);
I receive b with all the values set correctly (So at this point, Hibernate was able to use the method setName() correctly).
In my code if I then try to use b.getName(), I receive and error:
java.lang.IllegalAccessException-->Class org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer can not access a member of class A with modifiers "public"
But I am not trying to access A.getName(), but B.getName() (which is a public method in a public class).
This was working perfectly with Hibernate 2.1.7c and 3.1.3.
The full information about my problem can be found here: http://forum.hibernate.org/viewtopic.php?t=969453
--
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
15 years, 8 months
[Hibernate-JIRA] Created: (HHH-2745) NullPointerException when eager fetching joined many-to-many with native SQL query
by Mihail Fridliand (JIRA)
NullPointerException when eager fetching joined many-to-many with native SQL query
----------------------------------------------------------------------------------
Key: HHH-2745
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2745
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.1
Environment: Hibernate 3.2.1, DB2
Reporter: Mihail Fridliand
NullPointerException when joining many-to-many assoziation with native SQL query:
java.lang.NullPointerException
at org.hibernate.loader.custom.sql.SQLQueryParser.resolveProperties(SQLQueryParser.java:182)
at org.hibernate.loader.custom.sql.SQLQueryParser.resolveCollectionProperties(SQLQueryParser.java:135)
at org.hibernate.loader.custom.sql.SQLQueryParser.substituteBrackets(SQLQueryParser.java:98)
at org.hibernate.loader.custom.sql.SQLQueryParser.process(SQLQueryParser.java:51)
at org.hibernate.loader.custom.sql.SQLCustomQuery.<init>(SQLCustomQuery.java:110)
at org.hibernate.engine.query.NativeSQLQueryPlan.<init>(NativeSQLQueryPlan.java:43)
at org.hibernate.engine.query.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:114)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:444)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:351)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1291)
The SQLQueryReturnProcessor ignores many-to-many assoziations:
private void addCollection(String role, String alias, Map propertyResults) {
SQLLoadableCollection collectionPersister = ( SQLLoadableCollection ) factory.getCollectionPersister( role );
alias2CollectionPersister.put( alias, collectionPersister );
String suffix = generateCollectionSuffix();
log.trace( "mapping alias [" + alias + "] to collection-suffix [" + suffix + "]" );
alias2CollectionSuffix.put( alias, suffix );
collectionPropertyResultMaps.put( alias, propertyResults );
if ( collectionPersister.isOneToMany() ) {
SQLLoadable persister = ( SQLLoadable ) collectionPersister.getElementPersister();
addPersister( alias, filter( propertyResults ), persister );
}
}
Mapping of a many-to-many:
<hibernate-mapping>
<class name="A" table="A" schema="TEST" >
<set name="manyToMany" inverse="true" table="AC" >
<key>
<column name="A_OID" not-null="true" />
</key>
<many-to-many class="C">
<column name="C_OID" not-null="true" />
</many-to-many>
</set>
</class>
<class name="C" table="C" schema="TEST">
</class>
<resultset name="AandC">
<return alias="a" class="A"/>
<return-join alias="c" property="a.manyToMany"/>
</resultset>
<sql-query name="getAandC" resultset-ref="AandC" >
<![CDATA[
select DISTINCT {a.*},{c.*} from A a join AC ac on a.OID = ac.A_OID join C c on c.C_OID=ac.C_OID
]]>
</sql-query>
</hibernate-mapping>
--
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
15 years, 8 months
[Hibernate-JIRA] Created: (HHH-2276) Can not get N first results of query with DB2 dialect (neither with setMaxResults nor with setFetchSize)
by Fred (JIRA)
Can not get N first results of query with DB2 dialect (neither with setMaxResults nor with setFetchSize)
--------------------------------------------------------------------------------------------------------
Key: HHH-2276
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2276
Project: Hibernate3
Type: Bug
Components: query-criteria
Versions: 3.1.2
Environment: DB2 V7 version = DSN07012
DB OS = zOS
IBM DB2 JDBC Universal Driver Architecture
Version du pilote JDBC : 2.1.34
Using dialect: org.hibernate.dialect.DB2Dialect
Reporter: Fred
I can't get the N first records from a select request using the setMaxResults method.
HB generates a request that can not be understood by DB2 (select * from ( select rownumber() over() as rownumber etc.... see first stacktrace below)
Moreover, using setFetchSize does not work (see second stack trace below the first one).
Is there a way to tell HB to append " fetch first 10 rows only" to the query (as a workaround) ? Because my DB2 can understand that one :
select *
from MYTABLE
where numseq = '2'
fetch first 10 rows only
thanks !
Fred
STACK WITH SETMAXRESULTS :
Hibernate: select * from ( select rownumber() over() as rownumber_, * from A165D.TB3PARCV where TVOY='D' ) as temp_ where rownumber_ <= ?
[01/12/06 12:03:17:516 CET] 2d68c035 SystemOut O 12:03:17,516 67422 WARN JDBCExceptionReporter (logExceptions, 71 ) - SQL Error: -104, SQLState: 42601
12:03:17,516 67422 WARN JDBCExceptionReporter (logExceptions, 71 ) - SQL Error: -104, SQLState: 42601
12:03:17,516 67422 ERROR JDBCExceptionReporter (logExceptions, 72 ) - ILLEGAL SYMBOL "(". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: , FROM INTO
12:03:17,516 67422 ERROR JDBCExceptionReporter (logExceptions, 72 ) - ILLEGAL SYMBOL "(". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: , FROM INTO
12:03:17,516 67422 WARN JDBCExceptionReporter (logExceptions, 71 ) - SQL Error: -516, SQLState: 26501
12:03:17,516 67422 WARN JDBCExceptionReporter (logExceptions, 71 ) - SQL Error: -516, SQLState: 26501
12:03:17,547 67453 ERROR JDBCExceptionReporter (logExceptions, 72 ) - THE DESCRIBE STATEMENT DOES NOT SPECIFY A PREPARED STATEMENT
12:03:17,547 67453 ERROR JDBCExceptionReporter (logExceptions, 72 ) - THE DESCRIBE STATEMENT DOES NOT SPECIFY A PREPARED STATEMENT
12:03:17,547 67453 WARN JDBCExceptionReporter (logExceptions, 71 ) - SQL Error: -514, SQLState: 26501
12:03:17,547 67453 WARN JDBCExceptionReporter (logExceptions, 71 ) - SQL Error: -514, SQLState: 26501
12:03:17,578 67484 ERROR JDBCExceptionReporter (logExceptions, 72 ) - THE CURSOR SQL_CURLN300C4 IS NOT IN A PREPARED STATE
12:03:17,578 67484 ERROR JDBCExceptionReporter (logExceptions, 72 ) - THE CURSOR SQL_CURLN300C4 IS NOT IN A PREPARED STATE
12:03:17,578 67484 ERROR WAction (execute, 56 ) - org.hibernate.exception.SQLGrammarException: could not execute query
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2153)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:117)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1607)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:121)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:169)
[...]
Caused by: com.ibm.db2.jcc.a.SqlException: ILLEGAL SYMBOL "(". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: , FROM INTO
at com.ibm.db2.jcc.a.cy.e(cy.java:1507)
at com.ibm.db2.jcc.a.cy.a(cy.java:1117)
at com.ibm.db2.jcc.a.cy.a(cy.java:1103)
at com.ibm.db2.jcc.b.bd.h(bd.java:131)
at com.ibm.db2.jcc.b.bd.a(bd.java:42)
at com.ibm.db2.jcc.b.r.a(r.java:31)
at com.ibm.db2.jcc.b.bs.g(bs.java:149)
at com.ibm.db2.jcc.a.cy.l(cy.java:1097)
at com.ibm.db2.jcc.a.cz.bb(cz.java:1554)
at com.ibm.db2.jcc.a.cz.d(cz.java:1986)
at com.ibm.db2.jcc.a.cz.S(cz.java:424)
at com.ibm.db2.jcc.a.cz.executeQuery(cz.java:407)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeQuery(WSJdbcPreparedStatement.java:426)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2150)
... 52 more
_____________________________________________________________________________________________________
STACK WITH SETFETCHSIZE() :
[01/12/06 12:20:57:250 CET] 28ea8033 SystemOut O 11:20:57,250 403719 ERROR WAction (execute, 56 ) - org.hibernate.MappingException: No Dialect mapping for JDBC type: 3
org.hibernate.MappingException: No Dialect mapping for JDBC type: 3
at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)
at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:192)
at org.hibernate.loader.custom.CustomLoader.getHibernateType(CustomLoader.java:170)
at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:138)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1678)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2150)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:117)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1607)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:121)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:169)
--
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
15 years, 8 months