[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
Tue Jun 10 14:43:33 EDT 2008


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

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

Sorry, it is an Eclipse/Maven project, so you will need to install either the maven plugin for Eclipse or install maven from maven.apache.org.

you would then run Maven goal "package" and it will generate the java files.

I will go also attach another project that is based off ant.



> 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.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