[Hibernate-JIRA] Created: (HHH-2624) NullPointerException when Query.list()
by Eddie Man (JIRA)
NullPointerException when Query.list()
--------------------------------------
Key: HHH-2624
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2624
Project: Hibernate3
Issue Type: Bug
Components: core
Environment: MySQL database
Reporter: Eddie Man
Priority: Critical
Attachments: src.zip
The following exception was thrown when I calling Query.list():
Exception in thread "main" java.lang.NullPointerException
at org.hibernate.persister.entity.AbstractEntityPersister.loadByUniqueKey(AbstractEntityPersister.java:1641)
at org.hibernate.type.EntityType.loadByUniqueKey(EntityType.java:608)
at org.hibernate.type.EntityType.resolve(EntityType.java:382)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
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)
Reference issue :
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-48
Steps for reproduce the problem
==================
1. Unzip the attached file.
2. Execute the "schema.ddl" to create the tables.
3. Execute the "data.ddl" to insert the simple records.
4. Compile the src, and run the Main class.
--
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
[Hibernate-JIRA] Created: (HHH-3975) Sybase doesn't allow to set a null value for text field when save object
by Siuloong Ju (JIRA)
Sybase doesn't allow to set a null value for text field when save object
------------------------------------------------------------------------
Key: HHH-3975
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3975
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: Sybase 15.0.2 development liesence for windows
Hibernate:3.3.1
Reporter: Siuloong Ju
Priority: Critical
Save an object with one field mapped to sybase text type.
if the object text field doesn't be set a not-null value,then the object cann't be save.
HBM file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.test.sybase" default-access="field">
<class name="TestPO" table="TB_TEST">
<id name="id" column="hid" type="long" access="property">
<generator class="native"/>
</id>
<property name="extractID" type="java.lang.String" update="true" insert="true" column="extractID" length="60" not-null="true"/>
<property name="transactionID" type="java.lang.String" update="true" insert="true" column="transactionID" length="60" not-null="false"/>
<property name="testText" column="testText" type="text" not-null="false"/>
</class>
</hibernate-mapping>
the exceptions info:
JZ006: 捕获到 IO 例外:java.io.IOException: JZ0SL: 不受支持的 SQL 类型 2005。
Exception in thread "main" org.hibernate.exception.GenericJDBCException: could not insert: [com.wonders.sybase.TestPO]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:64)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2186)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2666)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:562)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546)
at com.wonders.sybase.SybaseTest.testSaveByHiberate(SybaseTest.java:39)
at com.wonders.sybase.SybaseTest.main(SybaseTest.java:27)
Caused by: java.sql.SQLException: JZ006: 捕获到 IO 例外:java.io.IOException: JZ0SL: 不受支持的 SQL 类型 2005。
at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source)
at com.sybase.jdbc3.jdbc.ErrorMessage.raiseErrorCheckDead(Unknown Source)
at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
at com.sybase.jdbc3.tds.Tds.language(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.sendQuery(Unknown Source)
at com.sybase.jdbc3.jdbc.SybPreparedStatement.sendQuery(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.execute(Unknown Source)
at com.sybase.jdbc3.jdbc.SybPreparedStatement.execute(Unknown Source)
at org.hibernate.id.IdentityGenerator$InsertSelectDelegate.executeAndExtract(IdentityGenerator.java:138)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)
... 17 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
15 years
[Hibernate-JIRA] Created: (HHH-4063) NPE reading metadata from an mapped interface
by Hernán Chanfreau (JIRA)
NPE reading metadata from an mapped interface
---------------------------------------------
Key: HHH-4063
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4063
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.3.2
Environment: Hibernate-core 3.3.2GA, Envers 1.2.1GA
Reporter: Hernán Chanfreau
Attachments: interface.mapping.test.zip
The problem arises when there is a mapped interface to load as a persistent class.
The metadata reader from envers do not care about interfaces.
See the discussion about it here:
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=156233
We've patch envers doing this:
In AuditedPropertiesReader.addPropertiesFromClass(XClass clazz) we add the condition superclazz != null.
private void addPropertiesFromClass(XClass clazz) {
XClass superclazz = clazz.getSuperclass();
// superclazz != null applies when superclazz is an interface
if ((superclazz != null) && (!"java.lang.Object".equals(superclazz.getName()))) {
addPropertiesFromClass(superclazz);
}
addFromProperties(clazz.getDeclaredProperties("field"), "field", fieldAccessedPersistentProperties);
addFromProperties(clazz.getDeclaredProperties("property"), "property", propertyAccessedPersistentProperties);
}
--
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
[Hibernate-JIRA] Created: (ANN-841) Bidirectional indexed collection mapped incorrectly for IndexedCollectionTest
by Gail Badner (JIRA)
Bidirectional indexed collection mapped incorrectly for IndexedCollectionTest
-----------------------------------------------------------------------------
Key: ANN-841
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-841
Project: Hibernate Annotations
Issue Type: Bug
Reporter: Gail Badner
Assignee: Emmanuel Bernard
Attachments: TEST-org.hibernate.test.annotations.indexcoll.IndexedCollectionTest.xml
I believe that two bidirectional associations with indexed collections that use join tables are mis-mapped for org.hibernate.test.annotations.indexcoll.IndexedCollectionTest.
Mappings in AddressBook:
@MapKey
@OneToMany(mappedBy = "book", cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REMOVE})
@JoinTable(name="AddRegEntry")
public Map<AddressEntryPk, AddressEntry> getEntries() {
return entries;
}
@MapKey(name = "directory")
@OneToMany(mappedBy = "book")
@JoinTable(name="Dir_Entry")
public Map<AlphabeticalDirectory, AddressEntry> getDirectoryEntries() {
return directoryEntries;
}
Mappings in AddressEntry:
@ManyToOne
public AddressBook getBook() {
return book;
}
@ManyToOne
public AlphabeticalDirectory getDirectory() {
return directory;
}
AddRegEntry and Dir_Entry are not generated in the DDL and the CRUD operations do not reference the join tables.
Test output is attached.
--
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
[Hibernate-JIRA] Created: (HHH-2993) NPE on org.hibernate.hql.ast.HqlSqlWalker, When Using explicit inner join on primitive type
by Vincent YSMAL (JIRA)
NPE on org.hibernate.hql.ast.HqlSqlWalker, When Using explicit inner join on primitive type
--------------------------------------------------------------------------------------------
Key: HHH-2993
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2993
Project: Hibernate3
Issue Type: Bug
Environment: Hibernate 3.2.5ga , oracle 10G, Windows
Reporter: Vincent YSMAL
Hi, trying to make an inne join on a primitve type cause an NPE.
java.lang.NullPointerException
at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:310)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3275)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3067)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
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.springframework.orm.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1219)
Trying some HQL like this :
"from Cat as cat inner join cat.name as a0 " cause an NPE
--
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
[Hibernate-JIRA] Created: (HHH-2399) FlushMode.AUTO practically unusable - should not flush before EVERY query
by Piotr Kołaczkowski (JIRA)
FlushMode.AUTO practically unusable - should not flush before EVERY query
-------------------------------------------------------------------------
Key: HHH-2399
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2399
Project: Hibernate3
Type: Improvement
Versions: 3.1.3, 3.2.1, 3.2.2, 3.2.0.ga
Environment: PostgreSQL 8.1.5, JDBC 2 and 3, Linux kernel 2.4.x, 2.6.x, Java 1.5.0_09
Reporter: Piotr Kołaczkowski
Attachments: hbtest.zip
The method flushIfRequired seems to flush before every query execution, even though there wasn't anything changed to the objects in the session, and the objects in the session are of different class than the object(s) queried. When having more than a few such objects in a session, it may lead to large, unneeded overheads (I noticed 10-200 times slowdown on simple queries). Our system uses many fast queries, that uasually return only one result or few results. The average query durations on different levels, measured by System.nanoTime() (see the attachment):
- database level: 0.05 ms
- pure JDBC code, prepared statements: 0.2 ms
- pure JDBC code, no prepared statements: 0.7 ms
- not cached hibernate query, no other objects associated with the session: 1.3 ms
- cached hibernate query, object in the session cache, no other objects associated with the session: 1.1 ms
- cached hibernate query, 10000 very simple objects of some other class in the session: >50 ms
10000 may seem large, but note these were very simple objects, having only 2 properties. On our production system we have classes with many properties, and even 20 objects in a session can cause a sub-millisecond query to run longer than 5 ms. We switched to FlushMode.COMMIT, and now the performance is much better.
Can you do something about this? As far as I've read in JIRA, a similar issue exists in Hibernate 2.x, and is still OPEN / UNRESOLVED.
BTW. Why is the 1st level cache so slow in my tests? Why reading just a 2 field object from the database cause so much overhead over pure JDBC? What am I doing wrong?
There is so much marketing about using cglib reflection optimizer in the performance FAQ but even if I retrieved these objects using JDBC and reflection, I would achieve much better performance. After all 1 ms is very much time, if getting results from DB and sending them to JVM lasts 0.2 ms.
--
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