[Hibernate-JIRA] Created: (HHH-2429) SQL Character Types Incorrectly mapped to Java objects
by Tyler Van Gorder (JIRA)
SQL Character Types Incorrectly mapped to Java objects
------------------------------------------------------
Key: HHH-2429
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2429
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.1
Environment: Hibernate 3.2.1, Oracle10g
Reporter: Tyler Van Gorder
We have a work flow that allows the user to enter an arbitrary SQL statement to be executed by our application. We pass those queries through session.createSQLQuery().
We ran into a problem with String literals, which are reported by Oracle (ResultSetMetaData) to be CHAR. Reading the JDBC API, CHAR is a fixed length string. Hibernate is incorrectly mapping this to a Character field. We ended up overriding the Oracle dialect with our own as follows:
In our constructor, for a dialect that extends Oracle9iDialect:
super()
registerColumnType(Types.CHAR, "char($l)" );
registerHibernateType( Types.CHAR, Hibernate.STRING.getName() );
The HibernateType is the crucial one and we are overriding the behavior in the base "Dialect" class, so this appears that it would be a problem for all database variants that don't explicitly change this.
Thanks.
--
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, 2 months
[Hibernate-JIRA] Created: (EJB-276) Support for CLOB not working for DB2 when table per concrete class is being used
by breako (JIRA)
Support for CLOB not working for DB2 when table per concrete class is being used
--------------------------------------------------------------------------------
Key: EJB-276
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-276
Project: Hibernate Entity Manager
Type: Bug
Versions: 3.2.1
Reporter: breako
Hi,
This came up in the forums:
http://forum.hibernate.org/viewtopic.php?p=2344008#2344008
Sample code: Two Pojos
@Entity
public class Person {
private int i;
@Identity
public int getI() {
return i;
}
public void setI(int i){
this.i = i;
}
}
@Entity
public class Employee extends Person{
@Basic(fetch=FetchType.LAZY)
@Lob
public String getClobAttr() {
return clobAttr;
}
public void setClobAttr(String clobAttr) {
this.clobAttr = clobAttr;
}
}
Simple test:
public static void main (String args[]) {
Query queryImpl = em.createQuery(" from Person");
List list = queryImpl.getResultList();
}
This will generate SQL
select person0_.clobAttr as clobAttr1 from (select nullif(0,0) as clobAttr from TPerson union all select clobAttr from TEmployee) person0_
which chucks the exception:
DB2 SQL error: SQLCODE: -415, SQLSTATE: 42825, SQLERRMC: null
I think the SQL hibernate should generate should be:
select person0_.clobAttr as clobAttr1 from (select cast(null as CLOB) as clobAttr from TPerson union all select clobAttr from TEmployee) person0_
--
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, 3 months
[Hibernate-JIRA] Created: (HHH-2225) NPE when eager fetching joined component with native SQL query
by Christian Bauer (JIRA)
NPE when eager fetching joined component with native SQL query
--------------------------------------------------------------
Key: HHH-2225
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2225
Project: Hibernate3
Type: Bug
Components: query-sql
Versions: 3.2.0.ga
Reporter: Christian Bauer
Priority: Minor
Item -> many-to-one -> User -> joined component -> billingAddress
This:
result = session.createSQLQuery("select {i.*}, {u.*}, {ba.*} from ITEM i" +
" join USERS u on i.SELLER_ID = u.USER_ID" +
" left join BILLING_ADDRESS ba on u.USER_ID = ba.USER_ID" +
" where u.USERNAME = :uname")
.addEntity("i", Item.class)
.addJoin("u", "i.seller")
.addJoin("ba", "u.billingAddress")
fails with:
java.lang.NullPointerException
at org.hibernate.loader.DefaultEntityAliases.<init>(DefaultEntityAliases.java:37)
at org.hibernate.loader.custom.sql.SQLQueryReturnProcessor.generateCustomReturns(SQLQueryReturnProcessor.java:283)
at org.hibernate.loader.custom.sql.SQLCustomQuery.<init>(SQLCustomQuery.java:129)
at org.hibernate.engine.query.NativeSQLQueryPlan.<init>(NativeSQLQueryPlan.java:43)
at org.hibernate.engine.query.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:114)
at org.hibernate.impl.AbstractSessionImpl.getNativeSQLQueryPlan(AbstractSessionImpl.java:137)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150)
--
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-2449) Lazy loading for one-to-one asociations
by jose (JIRA)
Lazy loading for one-to-one asociations
---------------------------------------
Key: HHH-2449
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2449
Project: Hibernate3
Type: New Feature
Components: core
Versions: 3.2.2
Environment: Hibernate 3.2.2
Reporter: jose
After read "Some explanations on lazy loading" and my tests I found a lossing feature in Hibernate (3.2.2).
one-to-one with lazy="proxy"_____________________________________________
Hibernate ALWAYS launch selects to know if one-to-one is null or can be proxied.
one-to-one with lazy="no-proxy"__________________________________________
Instrumentation allows to hibernate modify the getter to allows lazy loading on demand:
* but allways initialize ALL no-proxy relations (with first getter call)
-> must initialize ONLY the requested property
* never auto-initialize FETCH joins, ALWAYS doit on demand (if opened session)
-> must auto-initialize ONLY the FETCHED property
note: Can submit a fix for this? How?
NEW FEATURE: one-to-one with lazy="proxy" without multiple SELECTS______
If Hibernate adds join, for all one-to-one relations, to get the foreign-key of other tables, can check it to create a proxy or null.
note: that hibernate adds joins for hierarchy, why not for one-to-one relations?
This solution avoids:
* 'multiple subselects' after first select
* 'instrumentation' of bytecode
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-2169) L2 Cache and Long transactions Memory Leak : OutOfMemoryException
by Sami Dalouche (JIRA)
L2 Cache and Long transactions Memory Leak : OutOfMemoryException
-----------------------------------------------------------------
Key: HHH-2169
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2169
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.0.ga
Environment: [b]Hibernate version:[/b]
Hibernate Entity Manager 3.2.0, with Hibernate Core 3.2.0 and Hibernate Annotations 3.2.0
[b]Mapping documents:[/b]
Annotations
[b]Full stack trace of any exception that occurs:[/b]
Memory Heap Exception
[b]Name and version of the database you are using:[/b]
PosgreSQL 8.1
Reporter: Sami Dalouche
Summary
---------
When enabling L2 Cache (with either OScache and EhCache, both with a limitation on the max #of instances, so the problem shouldn't come from the cache manager), Hibernate cannot have long running transactions, otherwise, it results in a Memory Heap Exception...
The problem does NOT happen if the L2 Cache is disabled !
Details
----------
- Configure the code to run in ONE transaction
- Have a huge loop that inserts 2 million entries that are cacheable (@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE))
- flush() and clear() every 1000 entries, to periodically flush the cache
=> None of the entries are garbage collected.
=> Using a profiler, it is possible to trace the owning objects of my domain classes to :
- org.hibernate.action.EntityInsertAction ("instance" variable)
- array / List (variable elementData)
- variable "executions" in object .. class org.hibernate.engine.ActionQueue
Remarks :
- If the Query Cache is disabled, and the objects being inserted are NOT cacheable (no @Cache annotation), there is no problem
- If the Query Cache is enabled, then, no matter whether the objects being inserted are cacheable or not, The entries are never garbage collected, and I get an OutOfMemoryException. (I see NO relationship between the Query Cache and my objects. I never query the objects, only save them !!)
--
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, 6 months
[Hibernate-JIRA] Created: (HHH-2735) Query . setLockMode cannot find the alias when the query defines a select clause
by Tamir Solomon (JIRA)
Query . setLockMode cannot find the alias when the query defines a select clause
--------------------------------------------------------------------------------
Key: HHH-2735
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2735
Project: Hibernate3
Issue Type: Bug
Reporter: Tamir Solomon
I tried to perform the following :
Query q1 = session.createQuery("select serverIP.server from ServerIP serverIP where serverIP.ip = :ipStr");
q1.setLockMode("serverIP",LockMode.NONE);
q1.setParameter("ipStr", ip);
q1.list();
and i get this error :
Frame : java.lang.IllegalArgumentException: alias not found: serverIP
at org.hibernate.loader.hql.QueryLoader.applyLocks(QueryLoader.java:299)
at org.hibernate.loader.Loader.preprocessSQL(Loader.java:189)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1529)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
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)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:388)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
--
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, 6 months