[Hibernate-JIRA] Created: (HHH-3798) failure to lazy load a manyToOne and oneToMany mapped entity
by Ronald Kurz (JIRA)
failure to lazy load a manyToOne and oneToMany mapped entity
------------------------------------------------------------
Key: HHH-3798
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3798
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1, 3.5
Environment: hibernate annotations test case, maven profile hsqldb, svn rev 16079
hibernate-core 3.3.1.GA, JBoss 4.2.3, SQLServer 2000
Reporter: Ronald Kurz
Attachments: test-case.tar.gz
Following situtation: an entity Data has Revision entities (oneToMany). Each Revision entity belongs to a Data entity. The Data entity has one manyToOne mapping to the current Revision. The mappings from Data to Revision are all lazy.
When loading a Data entity, which has two Revisions, the Revision entity which is also mapped as manyToOne (the current Revision for that Data entity), does not get loaded. It will be an uninitialized proxy, which is also resistent to Hibernate.initialize(<Data>.revision). The same proxy is also in the oneToMany mapped list.
@Entity
public class Data {
@Id @GeneratedValue
public int id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "revisionId")
public Revision revision;
@OneToMany(mappedBy = "data")
public List<Revision> revisions = new ArrayList<Revision>();
}
@Entity
public class Revision {
@Id @GeneratedValue
public int id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "dataId", nullable = false, updatable = false)
public Data data;
public Integer number;
}
The test case is written for the hibernate-annotations project (simply because I never wrote a mapping using xml)
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-5137) NULLIF misinterpreted when a comma is set as a decimal point (DB2 z/OS)
by Leonardo (JIRA)
NULLIF misinterpreted when a comma is set as a decimal point (DB2 z/OS)
-----------------------------------------------------------------------
Key: HHH-5137
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5137
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Environment: Hibernate 3.3.2.GA, DB2 9 for z/OS
Reporter: Leonardo
Priority: Minor
If we set in DB2 a comma (instead a period) as a separator for decimal point I get an error when Hibernate executes this query:
DEBUG SQL:111 - select foo0_.id as id0_0_, foo0_.myBar_id as myBar1_3_0_, foo0_.clazz_ as clazz_0_ from ( select nullif(0,0) as myBar_id, id, 0 as clazz_ from Foo union all select nullif(0,0) as myBar_id, id, 1 as clazz_ from SubFoo2 union all select myBar_id, id, 2 as clazz_ from SubFoo1 ) foo0_ where foo0_.id=?
com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE: -170,
SQLSTATE: 42605, SQLERRMC: NULLIF
In fact, DB2 interprets the argument of nullif(0,0) as a decimal number and not as two arguments (zero, zero). DB2 documentation [1] says that if the comma is set as a decimal point a comma intended as a separator must be followed by a space. so in that case, nullif(0, 0) (note space after ',').
We are using DB2390Dialect and getSelectClauseNullString(int sqlType) method doesn't generate a correct nullif instruction in this case.
we could circumvent this issue by extending DB2390Dialect class and placing spaces after comma like this: return "nullif(" + literal + ", " + literal + ')'. But isn't a proper solution for us because we must release an extra jar with custom dialect to our customers.
[1] http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/c...
--
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
14 years, 5 months
[Hibernate-JIRA] Closed: (HHH-442) hibernate does not handle correctly covariant return types of java 1.5.
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-442?page=co... ]
Steve Ebersole closed HHH-442.
------------------------------
Resolution: Duplicate
> hibernate does not handle correctly covariant return types of java 1.5.
> -----------------------------------------------------------------------
>
> Key: HHH-442
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-442
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.0.2
> Environment: INFO: Hibernate 3.0.2
> Windows XP Pro
> java version "1.5.0_03"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
> Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)
> Reporter: Stefan Bühlmann
> Priority: Minor
> Attachments: covariant_problem.zip
>
>
> Hi Gavin,
> It seems as if hibernate does not handle correctly covariant return types of java 1.5.
> In the example included LocalWorkspace implements LocalWorkspaceI.
> The attribute visibleCommittedTrx and it's setters and getters use the type Transaction;
> But the interface LocalWorkspaceI uses TransactionI as a return type for getVisibleCommittedTrx().
> To put it the other way around, LocalWorkspace.getVisibleCommittedTrx() returns a class and not an interface, but this still implements the interface, since it is a covariant return type.
> It compiles nicely with java 1.5, but when run it get the following:
> org.hibernate.MappingException: An association from the table LOCALWORKSPACE refers to an unmapped class: x2.elements.interfaces.TransactionI
> This clearly shows, that hibernate tries to use TransactionI. But I never made a mapping for an interface!
> To use the stripped down example, just edit go.bat and set JAVA_HOME to your liking. Then run go.bat.
> But how can I upload a zip?
> Bye Stefan
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-5141) hql group by on multiple classes generates 1 query by class and can return a wrong number of results
by Eric Citaire (JIRA)
hql group by on multiple classes generates 1 query by class and can return a wrong number of results
----------------------------------------------------------------------------------------------------
Key: HHH-5141
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5141
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.3.0.SP1
Environment: Hibernate Annotations 3.4.0.GA, HSQLDB 1.8.0.10
Reporter: Eric Citaire
Priority: Critical
The classes DomesticDog and DomesticCat extend / implement Pet.
Here is the data of the 2 tables :
{{DomesticDog}}
{{+----+----------------------+}}
{{| 1 | Max |}}
{{| 2 | Buddy |}}
{{| 3 | Jake |}}
{{| 4 | Buddy |}}
{{+----+----------------------+}}
{{DomesticCat}}
{{+----+----------------------+}}
{{| 1 | Tiger |}}
{{| 2 | Smokey |}}
{{| 3 | Tiger |}}
{{| 4 | Max |}}
{{+----+----------------------+}}
Given the HQL query :
{{select pet.name from Pet pet group by pet.name having count(pet) > 1}}
Two SQL queries are generated and executed separately :
{{select domesticdog0_.name as col_0_0_ from DomesticDog domesticdog0_ group by domesticdog0_.name having count(domesticdog0_.id)>1}}
{{select domesticcat0_.name as col_0_0_ from DomesticCat domesticcat0_ group by domesticcat0_.name having count(domesticcat0_.id)>1}}
It returns only : "Buddy" and "Smokey". But it does not return "Max" wich is the name of a cat and a dog.
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-5099) Bug in CriteriaBuilder.in(Collection): IllegalArgumentException
by Max Hartmann (JIRA)
Bug in CriteriaBuilder.in(Collection): IllegalArgumentException
---------------------------------------------------------------
Key: HHH-5099
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5099
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-Final
Environment: hibernate 3.5, oracle 10g
Reporter: Max Hartmann
Method CriteriaBuilder.in(Collection<?> values) throws an IllegalArgumentException. It's a wonder, but when I call CriteriaBuilder.in(Object... values) no Exception is thrown.
Exception:
Exception in thread "main" java.lang.IllegalArgumentException: Parameter value [1] was not matching type [java.util.Arrays$ArrayList]
at org.hibernate.ejb.AbstractQueryImpl.registerParameterBinding(AbstractQueryImpl.java:340)
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:354)
at org.hibernate.ejb.criteria.expression.LiteralExpression$1.bind(LiteralExpression.java:84)
at org.hibernate.ejb.criteria.CriteriaQueryCompiler.compile(CriteriaQueryCompiler.java:174)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:432)
at test.server.TestApp.main(TestApp.java:29)
Code:
EntityManagerFactory factory = Persistence
.createEntityManagerFactory("userDatabase");
EntityManager em = factory.createEntityManager();
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> createQuery = cb.createQuery(String.class);
Root<TestBean> from = createQuery.from(TestBean.class);
createQuery.select(cb.function("TO_CHAR", String.class, from
.get(TestBean_.date1))).where(from
.get(TestBean_.id).in(Arrays.asList(new String[] {"1", "2"})));
List<String> resultList = em.createQuery(createQuery).getResultList();
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-5157) Discriminating on a value in a joined table
by Nicholas White (JIRA)
Discriminating on a value in a joined table
-------------------------------------------
Key: HHH-5157
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5157
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.1
Reporter: Nicholas White
I'm re-opening http://opensource.atlassian.com/projects/hibernate/browse/HHH-506 as the following case doesn't work, and HHH-506 doesn't provide a solution in enough detail:
Tables (for an Oracle database):
create table values (object integer, paramname varchar2(100), stringvalue varchar2(100), numbervalue integer);
create table types (paramname varchar2(100), isstring char(1));
create table objects (id integer);
Classes (missing getters and setters for readability reasons):
class Object { private Integer id; private Set<Value> parameters;}
abstract class Value {private String paramname;}
class StringValue extends Value { private String value;}
class IntegerValue extends Value { private Integer value;}
I'd like to use the isstring column in the types table as a discriminator - if it is 'Y' then the StringValue subclass should be generated with a value field populated from the stringvalue column of the values table. If it is 'N' then I'd like an IntegerValue subclass to be created with its value field populated from the numbervalue column of the values table.
Please don't reject this without providing an hbm.xml mappings file that maps this structure (and that works with an Oracle database).
Thanks,
Nick
--
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
14 years, 5 months