[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-1065) Named Query DAO methods with Primitive types fail to compile with JDK 1.4

Joe Porcheddu (JIRA) noreply at atlassian.com
Thu Jun 12 11:56:33 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-1065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_30405 ] 

Joe Porcheddu commented on HBX-1065:
------------------------------------

Max, were you able to reproduce the issue using the new project in the hbx469-ant.zip attachment?  Please let  me know if you need more info.
Thanks.

> Named Query DAO methods with Primitive types fail to compile with JDK 1.4
> -------------------------------------------------------------------------
>
>                 Key: HBX-1065
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1065
>             Project: Hibernate Tools
>          Issue Type: Bug
>          Components: hbm2java
>    Affects Versions: 3.2.0.GA
>            Reporter: Joe Porcheddu
>         Attachments: hbx469-ant.zip, hbx469.zip
>
>
> This is the same issue as HBX-469, but I was asked to create a new case and attach my test case.  Please see attached Eclipse/Maven project.
> The problem is that if a named query with a type of "java.lang.Long" or "java.lang.Integer" exists in an HBM file, then the Hbm2Dao task converts it to a primitive long. This causes the compile to fail if you are using JDK 1.4. 
> For example:
> <query name="findBySomeLong">
>         	<query-param name="someLong" type="java.lang.Long" />
>         	from Hbx469 where someLong=:someLong
> </query>
> when run through hbm2dao generates the following code:
>     public List findBySomeLong(long someLong) {
>         Query query = sessionFactory.getCurrentSession()
>                 .getNamedQuery("Hbx469.findBySomeLong");
>         query.setParameter("someLong", someLong);
>         return query.list();
>     }
> You will get a compile error on query.setParameter() when using JDK 1.4 because the java.lang.Long has been generated as a Java primitive long.

-- 
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list