Hello everyone,
I tried to find something alike my problem here but failed.
The problem:
There is a class which is managed by Hibernate
And there is another class which is property of managed class. I'd like to store it as BLOB field and did the following mapping.
<class
name="OperatorSessionState"
table="OPERATOR_SESSION_STATE"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="id"
column="id"
type="java.lang.String"
>
<generator class="assigned">
</generator>
</id>
<property
name="mission"
type="serializable"
update="true"
insert="true"
column="mission"
length="1000000"
/>
</class>
I deploy this thing in JBoss
Once deployed it works just fine - stores and retrieves complex 'mission' object.
BUT!
Once re-deployed, it gives me the following exception:
net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of eg.Mission>
at net.sf.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:68)
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:205)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2213)
at net.sf.hibernate.loader.Loader.doResultSet(Loader.java:216)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:111)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:663)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:678)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:57)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:49)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:429)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2122)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2000)
at net.sf.hibernate.impl.SessionImpl.internalLoadOneToOne(SessionImpl.java:1951)
at net.sf.hibernate.type.OneToOneType.resolveIdentifier(OneToOneType.java:77)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2208)
at net.sf.hibernate.loader.Loader.doResultSet(Loader.java:216)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:111)
at net.sf.hibernate.loader.Loader.find(Loader.java:731)
at net.sf.hibernate.hql.QueryTranslator.find(QueryTranslator.java:972)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1483)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1462)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1458)
Caused by:
java.lang.IllegalArgumentException: argument type mismatch
at java.lang.reflect.Method.invoke(Native Method)
at net.sf.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:38)
When I restart JBoss - everything is OK again till next redeployment.
An attempt to use exact class name instead of serializable type caused the very same behavior, except that instead of java.lang.IllegalArgumentException there was ClassCastException, with that very class name.
hibernate.jar and all her libs are there in server/default/lib
Seems like there is a classloader(s) who is caching version of that class on first run and then just keeps till JBoss' death.
What shall I do to not restart Jboss on every run? Put hibernate.jar and all that she needs into my .ear?
|