[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-490) Primitive type exception

Stan (JIRA) noreply at atlassian.com
Wed Aug 16 18:40:19 EDT 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-490?page=comments#action_23954 ] 

Stan commented on HBX-490:
--------------------------

i figured it out. the reason why Long works instead of long is:

the object property in question being loaded up is nullable, and so its reasonable that its default value isnt set.

..but when the pojo is actually created in java, a long must have a value. long cant be set to "null", but Long can.



> Primitive type exception
> ------------------------
>
>          Key: HBX-490
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-490
>      Project: Hibernate Tools
>         Type: Bug

>     Versions: 3.1beta2
>  Environment: Hibernate 3.1rc2, Oracle 9
>     Reporter: George Lindholm
>     Priority: Minor
>      Fix For: 3.1beta2

>
>
> I want to model/POJO one table (out of a large schema). The table has a reference to another table
> that I'm not modeling:
>         <property name="lastUpdtBy" type="long">
>             <column name="LAST_UPDT_BY" precision="10" scale="0" />
>         </property>
> which hbm2java turns into:
>    private long lastUpdtBy;
>    public void setLastUpdtBy(long lastUpdtBy) {
> however when I do a find("from ncOrgUnit") I get:
>   org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of ca.ubc.nmc.contacts.db.NcOrgUnit.lastUpdtBy
> If I change the method signature to 
>    public void setLastUpdtBy(Long lastUpdtBy) {
> the exception goes away and things seem to work.
>  

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