[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