-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: IllegalArgumentException occurred while calling ...
PostPosted: Sat Sep 27, 2003 5:36 pm 
Beginner
Beginner

Joined: Sat Sep 20, 2003 4:23 am
Posts: 48
I get the following error:

Code:
net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling: argument type mismatch setter of org.mathesis.user.User.userID
        net.sf.hibernate.util.ReflectHelper$Setter.set(ReflectHelper.java:65)
        net.sf.hibernate.persister.AbstractEntityPersister.setIdentifier(AbstractEntityPersister.java:244)
        net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:729)
        net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:607)
        org.mathesis.test.HibernateTest.createCats(HibernateTest.java:77)
        org.mathesis.test.HibernateTest.doGet(HibernateTest.java:52)


after calling this:

Code:
      out.print("<h3>Creating Users:</h3>");
      out.println("CREATING 'Jan Wandelaar'...<br/>");
      User imh = new User();
      imh.setEmailAddress("jan@domain.bogus");
      imh.setFirstName("Jan");
      imh.setLastName("Wandelaar");
      imh.setPassword("secret");
      imh.setUserName("jw");
      session.save(imh);


(the odd thing is that the user IS added, so the error occurs after a user has been added in the database)

The error occurs at: session.save(imh);

mapping:

Code:
        <id
            name="userID"
            column="USERID"
            type="long"
        >
            <generator class="native">
            </generator>
        </id>


mysql table structure:

Code:
+--------------+--------------+------+-----+---------+----------------+
| Field        | Type         | Null | Key | Default | Extra          |
+--------------+--------------+------+-----+---------+----------------+
| USERID       | bigint(11)   |      | PRI | NULL    | auto_increment |
| FIRSTNAME    | varchar(255) |      |     |         |                |
| LASTNAME     | varchar(255) |      |     |         |                |
| USERNAME     | varchar(255) |      |     |         |                |
| PASSWORD     | varchar(255) |      |     |         |                |
| EMAILADDRESS | varchar(255) |      |     |         |                |
+--------------+--------------+------+-----+---------+----------------+


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 27, 2003 7:34 pm 
Beginner
Beginner

Joined: Sat Sep 20, 2003 4:23 am
Posts: 48
neverminde, my own stupid mistake. A simple change of:

Code:
public void setUserID(int userID)


to

Code:
public void setUserID(long userID)


*ashamed*


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.