[Hibernate-JIRA] Created: (HHH-3208) NullPointerException thrown in ManyToOne.java
by Karol Nowak (JIRA)
NullPointerException thrown in ManyToOne.java
---------------------------------------------
Key: HHH-3208
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3208
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.6
Environment: Hibernate 3.2.6; Database: N/A
Reporter: Karol Nowak
Hibernate dies with ExceptionInInitializerError due to a NullPointerException being thrown in ManyToOne.java (see the trace below) when a property-ref attribute is set to a nonexistent property group. That's annoying and difficult to debug. Instead, Hibernate should inform that there's no matching group.
java.lang.ExceptionInInitializerError
at com.sabre.fs.emd.or.HibernateUtil.<clinit>(HibernateUtil.java:20)
at com.sabre.fs.emd.query.Executor.<init>(Executor.java:82)
at com.sabre.fs.emd.query.ExecutorTest.beforeTest(ExecutorTest.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:585)
at org.junit.internal.runners.MethodRoadie.runBefores(MethodRoadie.java:122)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:86)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
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.lang.NullPointerException
at org.hibernate.mapping.ManyToOne.createPropertyRefConstraints(ManyToOne.java:47)
at org.hibernate.cfg.HbmBinder$ManyToOneSecondPass.doSecondPass(HbmBinder.java:2717)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1130)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1286)
at com.sabre.fs.emd.or.HibernateUtil.<clinit>(HibernateUtil.java:15)
... 22 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
18 years
[Hibernate-JIRA] Created: (HHH-3207) NullPointerException during session.createSQLQuery() in multi thread enviornment
by manoj (JIRA)
NullPointerException during session.createSQLQuery() in multi thread enviornment
--------------------------------------------------------------------------------
Key: HHH-3207
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3207
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.5
Environment: oracle9i,hibernate3.2.5
Reporter: manoj
Priority: Blocker
when we are using session.createSQLQuery() in multi thread environment. We are getting NullPointerException. Please see the below stack trace.
11:29:31.976 ERROR invoke ApplicationDispatcher.java 704 Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.commons.collections.SequencedHashMap.removeEntry(SequencedHashMap.java:253)
at org.apache.commons.collections.SequencedHashMap.removeImpl(SequencedHashMap.java:511)
at org.apache.commons.collections.SequencedHashMap.remove(SequencedHashMap.java:498)
at org.apache.commons.collections.LRUMap.get(LRUMap.java:131)
at org.hibernate.util.SimpleMRUCache.get(SimpleMRUCache.java:36)
at org.hibernate.engine.query.QueryPlanCache.getSQLParameterMetadata(QueryPlanCache.java:49)
at org.hibernate.impl.AbstractSessionImpl.createSQLQuery(AbstractSessionImpl.java:124)
at org.hibernate.impl.SessionImpl.createSQLQuery(SessionImpl.java:1608)
--
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
18 years
[Hibernate-JIRA] Created: (HSHARDS-53) Map association not supported
by Oleg Ternovoi (JIRA)
Map association not supported
-----------------------------
Key: HSHARDS-53
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSHARDS-53
Project: Hibernate Shards
Issue Type: Bug
Components: engine
Affects Versions: 3.0.0.Beta2
Reporter: Oleg Ternovoi
Assignee: Max Ross
Beta 2 support only association extended from Collection.
If I have Map association then
Caused by: java.lang.ClassCastException: java.util.HashMap
at org.hibernate.shards.session.ShardedSessionImpl.getShardIdOfRelatedObject(ShardedSessionImpl.java:714)
at org.hibernate.shards.session.ShardedSessionImpl.selectShardIdForNewObject(ShardedSessionImpl.java:660)
at org.hibernate.shards.session.ShardedSessionImpl.save(ShardedSessionImpl.java:637)
at org.hibernate.shards.session.ShardedSessionImpl.save(ShardedSessionImpl.java:767)
<map name="selfParameters" cascade="all-delete-orphan" table="ConfSupplierParams">
<key>
<column name="supplierName" not-null="true" index="CSP_supplierName_FK"/>
</key>
<map-key type="string" column="name"/>
<composite-element class="com.ixtens.fenix.internal.server.persistence.config.ParameterValue">
<property name="value" length="4000" not-null="true"/>
<property name="type" length="1" not-null="true"/>
</composite-element>
</map>
--
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
18 years
[Hibernate-JIRA] Created: (EJB-348) Problem with CasCadeType.ALL during persist when processing OneToMany hierarchy relationship
by George Daswani (JIRA)
Problem with CasCadeType.ALL during persist when processing OneToMany hierarchy relationship
--------------------------------------------------------------------------------------------
Key: EJB-348
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-348
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.3.2.GA
Environment: 3.2.2.GA , Microsoft SQL Server 2000 SP4, JTDS 1.2.2 Drive
Reporter: George Daswani
Attachments: TestProject.zip
[Computer]
private Set<NetworkInterface> networkInterfaces ;
@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "computer")
@JoinColumn(name = "COMPUTER_ID")
public Set<NetworkInterface> getNetworkInterfaces()
---------------------
[Network Interface]
private Computer computer;
private Set<IPAddress> ipAddresses;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "CMP_ID", nullable = false)
public Computer getComputer()
@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "networkInterface")
@JoinColumn(name = "IP_ID")
public Set<IPAddress> getIPAddresses()
---------------------
[IPAddress]
private NetworkInterface networkInterface;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "NI_ID", nullable = false)
public NetworkInterface getNetworkInterface()
---------------------------------------------------------------------------------------------------
Note: works just fine with TopLink Essentials.
When two or more IP addresses are added to a network interface, Hibernate JPA errors out when persisting the "Computer".
Example:
Computer computer = new Computer();
// ASSIGNED ID
computer.setId("COMPUTER1");
computer.setAssetTag("AC1");
NetworkInterface networkInterface = new NetworkInterface();
networkInterface.setMacAddress("00:00:00:00:00:00");
computer.addNetworkInterface(networkInterface);
IPAddress ipAddress1 = new IPAddress();
ipAddress1.setIpAddress("192.168.1.1");
networkInterface.addIpAddress(ipAddress1);
IPAddress ipAddress2 = new IPAddress();
ipAddress2.setIpAddress("192.168.1.2");
networkInterface.addIpAddress(ipAddress2);
entityManager.persist(computer);
---------------- ERROR -----------
- INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK92788228A23'. The conflict occurred in database 'TestDB', table 'NI', column 'NI_ID'.
- Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
Caused by: java.sql.BatchUpdateException: INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK92788228A23'. The conflict occurred in database 'TestDB', table 'NI', column 'NI_ID'.
seems like some sort of wrong INSERTION order.
I've attached the eclipse project with the - test case in "test/Test.java"
--
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
18 years
[Hibernate-JIRA] Created: (HHH-3108) <load-collection role="entity_name.property"> doesn't work
by Marcin Mościcki (JIRA)
<load-collection role="entity_name.property"> doesn't work
----------------------------------------------------------
Key: HHH-3108
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3108
Project: Hibernate3
Issue Type: Bug
Components: metamodel
Affects Versions: 3.2.6
Environment: Hibernate 3.2.6, Oracle 9 (insignificant)
Reporter: Marcin Mościcki
Priority: Minor
I use an <sql-query> for a <loader> in a collection owned by a named entity. The role attribute is set to "<entity-name>.<property-name>" - exactly the key under witch the collection's meta data is registered in SessionFactoryImpl.collectionPersisters map - but when the query is being added, SessionFactoryImpl looks for it under the key "<package>.<entity-name>.<property-name>" in this map, and doesn't find it.
When entity-name attribute is removed from the entity mapping and unqualified class name is used to refer to it instead, everything works fine.
The easiest, and probably most uniform solution would be to introduce a second attribute "entity-role" to the load-collection element.
The following exception results from mapping:
<hibernate-mapping package="hibernatedemo.model">
....
<class table="persons_test" entity-name="person" name="Person">
....
<set name="personMap" inverse="true">
<key/>
<one-to-many entity-name="person_map"/>
<loader query-ref="fetch_person_map_by_person"/>
</set>
</class>
<sql-query name="fetch_person_map_by_person">
<load-collection alias="map" role="person.personMap" />
select {map.*} from persons_map_test map where map.person_id=:id
</sql-query>
org.hibernate.MappingException: Unknown collection role: hibernatedemo.model.person.personMap
at org.hibernate.impl.SessionFactoryImpl.getCollectionPersister(SessionFactoryImpl.java:558)
at org.hibernate.loader.custom.sql.SQLQueryReturnProcessor.addCollection(SQLQueryReturnProcessor.java:370)
at org.hibernate.loader.custom.sql.SQLQueryReturnProcessor.processCollectionReturn(SQLQueryReturnProcessor.java:405)
at org.hibernate.loader.custom.sql.SQLQueryReturnProcessor.processReturn(SQLQueryReturnProcessor.java:335)
at org.hibernate.loader.custom.sql.SQLQueryReturnProcessor.process(SQLQueryReturnProcessor.java:148)
at org.hibernate.loader.custom.sql.SQLCustomQuery.<init>(SQLCustomQuery.java:64)
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:446)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:352)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
at hibernatedemo.Test.getHibernateSession(Test.java:44)
at hibernatedemo.Test.main(Test.java:25)
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:324)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
--
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
18 years