Hibernate version:
3.2
Mapping documents:
Code:
<class name="main.org.jboss.portlet.milestone.spring.security.dto.User"
table="user">
<id column="id" name="id" type="long">
<generator class="increment" />
</id>
<property name="firstname" column="firstname" type="string" not-null="true"/>
<property name="lastname" column="lastname" type="string" not-null="true"/>
<property name="username" column="username" type="string" not-null="true"/>
<property name="email" column="email" type="string" not-null="true"/>
<property name="password" column="password" type="string" not-null="true"/>
<property name="expired" column="expired" type="boolean" />
<property name="locked" column="locked" type="boolean" />
<property name="enabled" column="enabled" type="boolean" />
<property name="credentialsExpired" column="credentialsExpired" type="boolean" />
<many-to-one name="authorities" not-null="true"
class="main.org.jboss.portlet.milestone.spring.dto.AccessLevel"
column="authorities_id" />
</class>
<class name="main.org.jboss.portlet.milestone.spring.dto.AccessLevel"
table="accesslevel">
<id column="id" name="id"><!-- Hier type nicht setzen -->
<generator class="increment" />
</id>
<property name="authority" column="authority" type="string" not-null="true"/>
<property name="description" column="description" type="string" />
</class>
Full stack trace of any exception that occurs:Code:
2007-04-12 12:02:07,562 ERROR [org.hibernate.property.BasicPropertyAccessor] - IllegalArgumentException in class: main.org.jboss.portlet.milestone.spring.dto.AccessLevel, getter method of property: id
2007-04-12 12:02:07,578 FATAL [main.org.jboss.portlet.milestone.spring.security.persistance.UserManager] - IllegalArgumentException occurred calling getter of main.org.jboss.portlet.milestone.spring.dto.AccessLevel.id; nested exception is org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of main.org.jboss.portlet.milestone.spring.dto.AccessLevel.id
Code:
2007-04-12 13:31:06,078 DEBUG [org.hibernate.impl.SessionImpl] - opened session at timestamp: 11763648660
2007-04-12 13:31:06,093 DEBUG [org.hibernate.loader.Loader] - loading entity: [main.org.jboss.portlet.milestone.spring.dto.AccessLevel#1]
2007-04-12 13:31:06,109 DEBUG [org.hibernate.jdbc.AbstractBatcher] - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2007-04-12 13:31:06,109 DEBUG [org.hibernate.jdbc.ConnectionManager] - opening JDBC connection
2007-04-12 13:31:06,109 DEBUG [org.hibernate.SQL] - select accessleve0_.id as id3_0_, accessleve0_.authority as authority3_0_, accessleve0_.description as descript3_3_0_ from accesslevel accessleve0_ where accessleve0_.id=?
2007-04-12 13:31:06,140 DEBUG [org.hibernate.jdbc.AbstractBatcher] - about to open ResultSet (open ResultSets: 0, globally: 0)
2007-04-12 13:31:06,156 DEBUG [org.hibernate.loader.Loader] - result row: EntityKey[main.org.jboss.portlet.milestone.spring.dto.AccessLevel#1]
2007-04-12 13:31:06,171 DEBUG [org.hibernate.jdbc.AbstractBatcher] - about to close ResultSet (open ResultSets: 1, globally: 1)
2007-04-12 13:31:06,171 DEBUG [org.hibernate.jdbc.AbstractBatcher] - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2007-04-12 13:31:06,171 DEBUG [org.hibernate.engine.TwoPhaseLoad] - resolving associations for [main.org.jboss.portlet.milestone.spring.dto.AccessLevel#1]
2007-04-12 13:31:06,171 DEBUG [org.hibernate.engine.TwoPhaseLoad] - done materializing entity [main.org.jboss.portlet.milestone.spring.dto.AccessLevel#1]
2007-04-12 13:31:06,171 DEBUG [org.hibernate.engine.StatefulPersistenceContext] - initializing non-lazy collections
2007-04-12 13:31:06,171 DEBUG [org.hibernate.loader.Loader] - done entity load
2007-04-12 13:31:06,171 DEBUG [org.hibernate.jdbc.ConnectionManager] - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2007-04-12 13:31:06,187 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] - processing flush-time cascades
2007-04-12 13:31:06,187 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] - dirty checking collections
2007-04-12 13:31:06,187 DEBUG [main.org.jboss.portlet.milestone.spring.dto.AccessLevel] - Entering AccessLevel.getId(): 1
2007-04-12 13:31:06,187 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
2007-04-12 13:31:06,187 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2007-04-12 13:31:06,187 DEBUG [org.hibernate.pretty.Printer] - listing entities:
2007-04-12 13:31:06,187 DEBUG [main.org.jboss.portlet.milestone.spring.dto.AccessLevel] - Entering AccessLevel.getId(): 1
2007-04-12 13:31:06,187 DEBUG [org.hibernate.pretty.Printer] - main.org.jboss.portlet.milestone.spring.dto.AccessLevel{id=1, authority=USER, description=user}
2007-04-12 13:31:06,187 DEBUG [org.hibernate.jdbc.ConnectionManager] - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2007-04-12 13:31:06,187 DEBUG [org.hibernate.jdbc.ConnectionManager] - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2007-04-12 13:31:06,187 DEBUG [main.org.jboss.portlet.milestone.spring.security.persistance.UserManager] - Entering UserManager.createUser
2007-04-12 13:31:06,187 DEBUG [main.org.jboss.portlet.milestone.spring.security.dto.User] - Entering User Constructor(...)
2007-04-12 13:31:06,187 DEBUG [main.org.jboss.portlet.milestone.spring.security.dto.User] - setting authority...
2007-04-12 13:31:06,187 DEBUG [org.hibernate.impl.SessionImpl] - opened session at timestamp: 11763648661
2007-04-12 13:31:06,203 DEBUG [org.hibernate.id.IncrementGenerator] - fetching initial value: select max(id) from user
2007-04-12 13:31:06,203 DEBUG [org.hibernate.jdbc.AbstractBatcher] - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2007-04-12 13:31:06,203 DEBUG [org.hibernate.jdbc.ConnectionManager] - opening JDBC connection
2007-04-12 13:31:06,203 DEBUG [org.hibernate.SQL] - select max(id) from user
2007-04-12 13:31:06,265 DEBUG [org.hibernate.id.IncrementGenerator] - first free id: 1
2007-04-12 13:31:06,265 DEBUG [org.hibernate.jdbc.AbstractBatcher] - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2007-04-12 13:31:06,265 DEBUG [org.hibernate.event.def.AbstractSaveEventListener] - generated identifier: 1, using strategy: org.hibernate.id.IncrementGenerator
2007-04-12 13:31:06,265 ERROR [org.hibernate.property.BasicPropertyAccessor] - IllegalArgumentException in class: main.org.jboss.portlet.milestone.spring.dto.AccessLevel, getter method of property: id
2007-04-12 13:31:06,265 DEBUG [org.hibernate.jdbc.ConnectionManager] - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2007-04-12 13:31:06,265 DEBUG [org.hibernate.jdbc.ConnectionManager] - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2007-04-12 13:31:06,265 FATAL [main.org.jboss.portlet.milestone.spring.security.persistance.UserManager] - IllegalArgumentException occurred calling getter of main.org.jboss.portlet.milestone.spring.dto.AccessLevel.id; nested exception is org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of main.org.jboss.portlet.milestone.spring.dto.AccessLevel.id
2007-04-12 13:31:06,265 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] - processing flush-time cascades
2007-04-12 13:31:06,265 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] - dirty checking collections
2007-04-12 13:31:06,265 DEBUG [org.hibernate.engine.Collections] - Collection found: [org.jboss.portal.core.impl.model.portal.PortalObjectImpl.declaredProperties#1], was: [org.jboss.portal.core.impl.model.portal.PortalObjectImpl.declaredProperties#1] (uninitialized)
2007-04-12 13:31:06,265 DEBUG [org.hibernate.engine.Collections] - Collection found: [org.jboss.portal.core.impl.model.portal.ObjectNode.children#1], was: [org.jboss.portal.core.impl.model.portal.ObjectNode.children#1] (initialized)
2007-04-12 13:31:06,265 DEBUG [org.hibernate.engine.Collections] - Collection found: ...
Name and version of the database you are using:mysql
and here is the code, where it appears:
Code:
try {
User tmpUser = new User(fname, lname, email, uname, getMD5Hash(password),authrity);
Long tmpid = (Long)getHibernateTemplate().save(tmpUser); [b]//HERE[/b]
if(logger.isDebugEnabled())
logger.debug("User created with ID: " + tmpid);
return true;
} catch (Exception e) {
logger.fatal(e.getMessage());
return false;
}
AccessLevel Code
Code:
public class AccessLevel implements GrantedAuthority{
private static final long serialVersionUID = -2955606795781624560L;
static Logger logger = Logger.getLogger(AccessLevel.class);
static{
logger.setLevel(Level.ALL);
}
private Integer id;
private String authority;
private String description;
public AccessLevel(){
super();
}
public AccessLevel(String auth, String desc){
super();
if(logger.isDebugEnabled())
logger.debug("Entring AccessLevel Constructor(...)");
this.authority = auth;
this.description = desc;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getId() {
if(logger.isDebugEnabled())
logger.debug("Entering AccessLevel.getId(): " + id);
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getAuthority() {
return authority;
}
public void setAuthority(String authority) {
this.authority = authority;
}
}
any suggestions?
thanks in advance,
omid