[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Persisting a Pojo within a Pojo

2008-07-30 Thread lebonijt
Hello,

I was wondering if anyone has written a custom CacheLoader dealing with this 
issue.  The list of modifications per tx is difficult to translate into the 
objects to persist to our persistent storeIf anyone has had any success in 
doing this please let me know.

Thansk

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4167648#4167648

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4167648
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Persisting complex java objects as CLOBs

2007-11-15 Thread mike.nardone
I'm currently developing a java application deployed on JBoss 4.2.1GA, with MS 
SQL Server 2000 on the backend.  I have a rather complex Java object, which may 
contain lists of the same object as children.  Instead of reworking the entire 
structure of this object, I would like to just write it to my DB as a binary 
stream.  In my current implementation, thisactually works on the insertion side 
of things.  However, when I try to read my CLOB back out I get the following 
exception:

 org.hibernate.exception.GenericJDBCException: could not initialize a 
collection: [class.name.here]
.
.
.
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for 
JDBC]Unsupported data conversion.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown 
Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseData.unsupportedConversion(Unknown 
Source)
at com.microsoft.jdbc.base.BaseData.getBlob(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getBlob(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getBlob(Unknown Source)
at 
org.jboss.resource.adapter.jdbc.WrappedResultSet.getBlob(WrappedResultSet.java:380)
at 
org.hibernate.type.SerializableToBlobType.get(SerializableToBlobType.java:57)
at 
org.hibernate.type.AbstractLobType.nullSafeGet(AbstractLobType.java:46)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
at 
org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2096)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
at org.hibernate.loader.Loader.getRow(Loader.java:1206)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
at org.hibernate.loader.Loader.doQuery(Loader.java:701)
at 
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1994)
at 
org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
at 
org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565)
at 
org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
at 
org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716)
at 
org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:454)
at 
org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:797)
at 
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:241)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1994)
at 
org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
at 
org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565)
at 
org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
at 
org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716)
at 
org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
at 
org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
at 
org.hibernate.collection.PersistentBag.toArray(PersistentBag.java:257)
at java.util.ArrayList.addAll(ArrayList.java:473)
at 
us.dac.aip.agent.beans.StandingQueryManagerBean.getQueriesByUser(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at 
org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at 
org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at 
org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at 
org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at 
org.jboss.a

[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Persisting

2006-07-21 Thread jactor
I recently put this in the EJB forum and later discovered that this is where it 
should be:
I am trying to develop a entity which extends another entity and which use the 
annotation @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS), but this 
only provides an exception as the sub class does not have an @Id annotated:

org.hibernate.MappingException: Cannot use identity column key generation with 
 mapping for: concept.entity.Entity

However: If I do annotate this @Id, I get this one:

org.hibernate.AnnotationException: Unable to define/override @Id(s) on a 
subclass: concept.entity.En
  | tity

Suggestions?

I had the idea that @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) 
would give a new table with every field from the sub classes and mother class 
in this table. I searched the final draft on persistence for this notation but 
I came up with no suitable instances found.

Is this assumption of the strategy correct or (especially since this is not 
working) is it another way of doing this?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959842#3959842

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959842
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user