[Hibernate-JIRA] Created: (HHH-5737) Error message regarding JNDI binding...how to get rid of it?
by Colbert Philippe (JIRA)
Error message regarding JNDI binding...how to get rid of it?
------------------------------------------------------------
Key: HHH-5737
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5737
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.0
Environment: Windows 7, Java 1.6_22
Reporter: Colbert Philippe
I have a very simple environment, not tied to JNDI service. I am simply creating class mapping files for a project and incorporating them into my Hibernate setup.
During initialization, I am getting this error message related to JNDI. Does anybody know how to resolve this error message?
========================================================
21:59:34,971 INFO SettingsFactory: 351 - Check Nullability in Core (should be disabled when Bean Validation is on): enabled
21:59:34,993 INFO SessionFactoryImpl: 200 - building session factory
21:59:35,165 INFO SessionFactoryObjectFactory: 109 - Factory name: Local MySQL
21:59:35,166 INFO NamingHelper: 49 - JNDI InitialContext properties:{}
21:59:35,169 WARN SessionFactoryObjectFactory: 121 - Could not bind factory to JNDI
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getNameParser(Unknown Source)
at org.hibernate.util.NamingHelper.bind(NamingHelper.java:75)
at org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObjectFactory.java:113)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:365)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842)
at rally.core.test.HibernateCreateDbTest.testInitialize(HibernateCreateDbTest.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
21:59:35,180 INFO SchemaExport: 234 - Running hbm2ddl schema export
--
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-5713) Member of doesn't work with a @ElementCollection of String
by Antonio Goncalves (JIRA)
Member of doesn't work with a @ElementCollection of String
----------------------------------------------------------
Key: HHH-5713
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5713
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.0
Reporter: Antonio Goncalves
Attachments: JavaEE6Devoxx.zip
Also see https://forum.hibernate.org/viewtopic.php?f=1&t=1007606&p=2437844
I have the following @Entity :
{code}
public class Book {
@Id @GeneratedValue
private Long id;
private String title;
private Float price;
private String isbn;
@ElementCollection
@CollectionTable(name = "tags")
private List<String> tags = new ArrayList<String>();
{code}
I use {{@ElementCollection}} to have a list of strings (tags you can add to books). I want to find all the books that have a tag equals to "scifi", so I wrote the following named query :
{code}
SELECT b FROM Book b WHERE 'scifi' member of b.tags
{code}
But here is what I get (with log level at debug) :
{code}
10:53:14,512 DEBUG QueryTranslatorImpl:272 - parse() - HQL: SELECT b FROM org.beginningee6.tutorial.Book b WHERE 'scifi' member of b.tags
10:53:14,527 DEBUG AST:291 - --- HQL AST ---
\-[QUERY] Node: 'query'
+-[SELECT_FROM] Node: 'SELECT_FROM'
| +-[FROM] Node: 'FROM'
| | \-[RANGE] Node: 'RANGE'
| | +-[DOT] Node: '.'
| | | +-[DOT] Node: '.'
| | | | +-[DOT] Node: '.'
| | | | | +-[IDENT] Node: 'org'
| | | | | \-[IDENT] Node: 'beginningee6'
| | | | \-[IDENT] Node: 'tutorial'
| | | \-[IDENT] Node: 'Book'
| | \-[ALIAS] Node: 'b'
| \-[SELECT] Node: 'SELECT'
| \-[IDENT] Node: 'b'
\-[WHERE] Node: 'WHERE'
\-[IN] Node: 'in'
+-[QUOTED_STRING] Node: ''scifi''
\-[IN_LIST] Node: 'inList'
\-[QUERY] Node: 'QUERY'
\-[SELECT_FROM] Node: 'SELECT_FROM'
\-[FROM] Node: 'from'
\-[RANGE] Node: 'RANGE'
\-[DOT] Node: '.'
+-[IDENT] Node: 'b'
\-[IDENT] Node: 'tags'
10:53:14,527 DEBUG ErrorCounter:91 - throwQueryException() : no errors
10:53:14,527 DEBUG HqlSqlBaseWalker:111 - select << begin [level=1, statement=select]
10:53:14,527 DEBUG FromElement:157 - FromClause{level=1} : org.beginningee6.tutorial.Book (b) -> book0_
10:53:14,527 DEBUG FromReferenceNode:74 - Resolved : b -> book0_.id
10:53:14,527 DEBUG HqlSqlBaseWalker:111 - select << begin [level=2, statement=select]
10:53:14,543 DEBUG FromElementFactory:131 - createFromElementInSubselect() : path = b.tags
10:53:14,543 DEBUG PathHelper:69 - parsePath() : b.tags -> [ ( . b tags ) ]
10:53:14,543 DEBUG FromReferenceNode:74 - Resolved : b -> book0_.id
10:53:14,543 DEBUG DotNode:613 - getDataType() : tags -> org.hibernate.type.BagType(org.beginningee6.tutorial.Book.tags)
10:53:14,543 DEBUG FromElement:157 - FromClause{level=2} : null (no alias) -> tags1_
10:53:14,543 DEBUG FromClause:368 - addCollectionJoinFromElementByPath() : b.tags -> tags
10:53:14,543 DEBUG DotNode:306 - dereferenceCollection() : Created new FROM element for b.tags : tags tags1_
10:53:14,543 DEBUG FromReferenceNode:74 - Resolved : b.tags -> .
10:53:14,543 DEBUG FromElementFactory:164 - createFromElementInSubselect() : b.tags -> tags tags1_
10:53:14,543 DEBUG HqlSqlBaseWalker:117 - select : finishing up [level=2, statement=select]
10:53:14,543 DEBUG HqlSqlWalker:620 - processQuery() : ( SELECT ( FromClause{level=2} tags tags1_ ) )
10:53:14,543 DEBUG HqlSqlWalker:863 - Derived SELECT clause created.
10:53:14,543 DEBUG SyntheticAndFactory:94 - Using unprocessed WHERE-fragment [book0_.id=tags1_.Book_id]
10:53:14,543 DEBUG SyntheticAndFactory:125 - Using processed WHERE-fragment [book0_.id=tags1_.Book_id]
10:53:14,543 DEBUG QueryNode:74 - getWhereClause() : Creating a new WHERE clause...
10:53:14,543 DEBUG HqlSqlBaseWalker:123 - select >> end [level=2, statement=select]
10:53:14,543 DEBUG HqlSqlBaseWalker:117 - select : finishing up [level=1, statement=select]
10:53:14,543 DEBUG HqlSqlWalker:620 - processQuery() : ( SELECT ( {select clause} book0_.id ) ( FromClause{level=1} ) ( WHERE ( in 'scifi' ( inList ( SELECT {derived select clause} ( FromClause{level=2} tags tags1_ ) ( WHERE ( {theta joins} book0_.id=tags1_.Book_id ) ) ) ) ) ) )
10:53:14,543 DEBUG JoinProcessor:179 - Using FROM fragment [Book book0_]
10:53:14,543 DEBUG HqlSqlBaseWalker:123 - select >> end [level=1, statement=select]
10:53:14,559 DEBUG AST:258 - --- SQL AST ---
\-[SELECT] QueryNode: 'SELECT' querySpaces (tags,Book)
+-[SELECT_CLAUSE] SelectClause: '{select clause}'
| +-[ALIAS_REF] IdentNode: 'book0_.id as id0_' {alias=b, className=org.beginningee6.tutorial.Book, tableAlias=book0_}
| \-[SQL_TOKEN] SqlFragment: 'book0_.contentLanguage as contentL2_0_, book0_.description as descript3_0_, book0_.illustrations as illustra4_0_, book0_.isbn as isbn0_, book0_.nbOfPage as nbOfPage0_, book0_.price as price0_, book0_.title as title0_'
+-[FROM] FromClause: 'FROM' FromClause{level=1, fromElementCounter=1, fromElements=1, fromElementByClassAlias=[b], fromElementByTableAlias=[book0_], fromElementsByPath=[], collectionJoinFromElementsByPath=[], impliedElements=[]}
| \-[FROM_FRAGMENT] FromElement: 'Book book0_' FromElement{explicit,collection join,not a fetch join,fetch non-lazy properties,classAlias=b,role=null,tableName=Book,tableAlias=book0_,origin=null,columns={,className=org.beginningee6.tutorial.Book}}
\-[WHERE] SqlNode: 'WHERE'
\-[IN] InLogicOperatorNode: 'in'
+-[QUOTED_STRING] LiteralNode: ''scifi''
\-[IN_LIST] SqlNode: 'inList'
\-[SELECT] QueryNode: 'SELECT' querySpaces (tags,Book)
+-[SELECT_CLAUSE] SelectClause: '{derived select clause}'
+-[FROM] FromClause: 'from' FromClause{level=2, fromElementCounter=0, fromElements=1, fromElementByClassAlias=[], fromElementByTableAlias=[tags1_], fromElementsByPath=[], collectionJoinFromElementsByPath=[b.tags], impliedElements=[]}
| \-[FROM_FRAGMENT] ImpliedFromElement: 'tags tags1_' ImpliedFromElement{implied,collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=org.beginningee6.tutorial.Book.tags,tableName={none},tableAlias=tags1_,origin=Book book0_,columns={,className=null}}
\-[WHERE] SqlNode: 'WHERE'
\-[THETA_JOINS] SqlNode: '{theta joins}'
\-[SQL_TOKEN] SqlFragment: 'book0_.id=tags1_.Book_id'
10:53:14,574 DEBUG ErrorCounter:91 - throwQueryException() : no errors
10:53:14,574 ERROR PARSER:56 - <AST>:0:0: unexpected end of subtree
10:53:14,574 DEBUG ErrorCounter:51 - <AST>:0:0: unexpected end of subtree
<AST>:0:0: unexpected end of subtree
at org.hibernate.hql.antlr.SqlGeneratorBase.selectClause(SqlGeneratorBase.java:523)
at org.hibernate.hql.antlr.SqlGeneratorBase.selectStatement(SqlGeneratorBase.java:175)
at org.hibernate.hql.antlr.SqlGeneratorBase.parenSelect(SqlGeneratorBase.java:3438)
at org.hibernate.hql.antlr.SqlGeneratorBase.inList(SqlGeneratorBase.java:3315)
at org.hibernate.hql.antlr.SqlGeneratorBase.exoticComparisonExpression(SqlGeneratorBase.java:3158)
at org.hibernate.hql.antlr.SqlGeneratorBase.comparisonExpr(SqlGeneratorBase.java:1297)
at org.hibernate.hql.antlr.SqlGeneratorBase.booleanExpr(SqlGeneratorBase.java:910)
at org.hibernate.hql.antlr.SqlGeneratorBase.whereExpr(SqlGeneratorBase.java:768)
at org.hibernate.hql.antlr.SqlGeneratorBase.selectStatement(SqlGeneratorBase.java:191)
at org.hibernate.hql.antlr.SqlGeneratorBase.statement(SqlGeneratorBase.java:119)
at org.hibernate.hql.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:238)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:205)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:547)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:411)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
at org.beginningee6.tutorial.BookTest.initEntityManager(BookTest.java:42)
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:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:94)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)
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:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
10:53:14,590 ERROR PARSER:56 - <AST>:0:0: expecting "from", found '<ASTNULL>'
10:53:14,590 DEBUG ErrorCounter:51 - <AST>:0:0: expecting "from", found '<ASTNULL>'
<AST>:0:0: expecting "from", found '<ASTNULL>'
at antlr.TreeParser.match(TreeParser.java:68)
at org.hibernate.hql.antlr.SqlGeneratorBase.from(SqlGeneratorBase.java:570)
at org.hibernate.hql.antlr.SqlGeneratorBase.selectStatement(SqlGeneratorBase.java:177)
at org.hibernate.hql.antlr.SqlGeneratorBase.parenSelect(SqlGeneratorBase.java:3438)
at org.hibernate.hql.antlr.SqlGeneratorBase.inList(SqlGeneratorBase.java:3315)
at org.hibernate.hql.antlr.SqlGeneratorBase.exoticComparisonExpression(SqlGeneratorBase.java:3158)
at org.hibernate.hql.antlr.SqlGeneratorBase.comparisonExpr(SqlGeneratorBase.java:1297)
at org.hibernate.hql.antlr.SqlGeneratorBase.booleanExpr(SqlGeneratorBase.java:910)
at org.hibernate.hql.antlr.SqlGeneratorBase.whereExpr(SqlGeneratorBase.java:768)
at org.hibernate.hql.antlr.SqlGeneratorBase.selectStatement(SqlGeneratorBase.java:191)
at org.hibernate.hql.antlr.SqlGeneratorBase.statement(SqlGeneratorBase.java:119)
at org.hibernate.hql.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:238)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:205)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:547)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:411)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
at org.beginningee6.tutorial.BookTest.initEntityManager(BookTest.java:42)
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:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:94)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)
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:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
10:53:14,621 DEBUG QueryTranslatorImpl:241 - HQL: SELECT b FROM org.beginningee6.tutorial.Book b WHERE 'scifi' member of b.tags
10:53:14,621 DEBUG QueryTranslatorImpl:242 - SQL: select book0_.id as id0_, book0_.contentLanguage as contentL2_0_, book0_.description as descript3_0_, book0_.illustrations as illustra4_0_, book0_.isbn as isbn0_, book0_.nbOfPage as nbOfPage0_, book0_.price as price0_, book0_.title as title0_ from Book book0_ where 'scifi' in (select )
10:53:14,621 DEBUG SessionFactoryImpl:557 - Checking 0 named SQL queries
10:53:14,621 ERROR SessionFactoryImpl:422 - Error in named query: findAllScifiBooks
org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree [SELECT b FROM org.beginningee6.tutorial.Book b WHERE 'scifi' member of b.tags]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82)
at org.hibernate.hql.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:244)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:205)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:547)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:411)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
at org.beginningee6.tutorial.BookTest.initEntityManager(BookTest.java:42)
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:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:94)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)
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:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
{code}
Attached is the entity and the unit test that makes it break. The Maven project uses GlassFish (EclipseLink) by default, so you can make it run using {{mvn -Pjboss test}}. Also you need the Derby database running (I'm not using an inmemory DB for this 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
13 years, 4 months
[Hibernate-JIRA] Created: (HHH-3524) setFetchMode ignored if using createCriteria
by Peter Weemeeuw (JIRA)
setFetchMode ignored if using createCriteria
--------------------------------------------
Key: HHH-3524
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3524
Project: Hibernate Core
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.5
Environment: Hibernate 3.2.5, Oracle 8
Reporter: Peter Weemeeuw
Hi,
It seems that criteria.setFetchMode gets ignored if you combine it with createCriteria to add a restriction.
This works as expected:
DetachedCriteria c = DetachedCriteria.forClass(MenuItem.class);
c.setFetchMode("menuItemSubscriptions", FetchMode.JOIN);
But in this case the join doesn't happen (and I get a LazyInstantiationException further on).
DetachedCriteria c = DetachedCriteria.forClass(MenuItem.class);
c.setFetchMode("menuItemSubscriptions", FetchMode.JOIN);
c.createCriteria("menuItemSubscriptions").add(
Restrictions.eq("location", "B")
);
This does not happen if I set lazy="false" in the mappings
file.
Regards,
Peter
--
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: (HV-384) Performence problem when using programatic constrain declaration
by Jan Cuzy (JIRA)
Performence problem when using programatic constrain declaration
----------------------------------------------------------------
Key: HV-384
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-384
Project: Hibernate Validator
Issue Type: Bug
Affects Versions: 4.1.0.Final
Environment: Java 1.6, OSGi Equinox
Reporter: Jan Cuzy
Assignee: Hardy Ferentschik
I'm using the programmatic API to declare the constrains on class.
{noformat} ConstraintMapping constraintMapping = ...
HibernateValidatorConfiguration config = ...
config.addMapping(constraintMapping);
ValidatorFactory factory = config.buildValidatorFactory();{noformat}
Right now I have 73 with 745 configured constrains on them (This is rather beginning of the project, in the future numbers will be higher). It takes approx. 6 seconds to create the validator factory. I was investigating a bit and found a method initProgrammaticConfiguration in ValidatorFactoryImpl class, which calls vary often the method getConstraintConfig() on the ConstraintMapping class.
This method creates always new
{noformat}<A extends Annotation> Map<Class<?>, List<ConstraintDefWrapper<?>>>{noformat}
based on values in its member variable
{noformat} private final Map<Class<?>, List<ConstraintDef<?>>> constraintConfig{noformat}
Is there any problem to cache the created map as a meber in the ConstraintMapping class?
I've done
{noformat}
public class ConstraintMapping {
private final Map<Class<?>, List<ConstraintDef<?>>> constraintConfig;
private Map<Class<?>, List<ConstraintDefWrapper<?>>> newDefinitions;
...
{noformat}
then
{noformat} public final <A extends Annotation> Map<Class<?>, List<ConstraintDefWrapper<?>>> getConstraintConfig() {
*if (newDefinitions == null) {*
*newDefinitions = new HashMap<Class<?>, List<ConstraintDefWrapper<?>>>();*
for (Map.Entry<Class<?>, List<ConstraintDef<?>>> entry : constraintConfig.entrySet()) {
List<ConstraintDefWrapper<?>> newList = new ArrayList<ConstraintDefWrapper<?>>();
for (ConstraintDef<?> definition : entry.getValue()) {
Class<?> beanClass = definition.beanType;
@SuppressWarnings("unchecked")
ConstraintDefWrapper<A> defAccessor = new ConstraintDefWrapper<A>(beanClass,
(Class<A>) definition.constraintType, definition.property, definition.elementType,
definition.parameters, this);
newList.add(defAccessor);
}
newDefinitions.put(entry.getKey(), newList);
}
*}*
return newDefinitions;
}{noformat}
and then maybe also
{noformat} protected final void addConstraintConfig(ConstraintDef<?> definition) {
Class<?> beanClass = definition.beanType;
configuredClasses.add(beanClass);
if (constraintConfig.containsKey(beanClass)) {
constraintConfig.get(beanClass).add(definition);
}
else {
List<ConstraintDef<?>> definitionList = new ArrayList<ConstraintDef<?>>();
definitionList.add(definition);
constraintConfig.put(beanClass, definitionList);
*newDefinitions = null;*
}
}
{noformat}
and the time which is needed to create the factory is 200ms.
--
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