Estou com um problema ao tentar gravar um campo xml no banco de dados SQLServer utilizando o hibernate.
O campo está mapeado no hibernate como Clob.
A aplicação é client / server, estou usando RMI para transferir os dados para o server. Também estou usando o server JBoss4.
Recebo a seguinte exception quando o objeto chega no server: java.lang.IllegalStateException: Clobs may not be accessed after serialization.
Segue o meu cógido antes de publicar:
setXML_DATA recebe um Clob e conteudoArquivo é uma String.
Alguém já passou por isso e poderia me ajudar.
Obrigado.
Talvez esses links te ajudem.
https://forum.hibernate.org/viewtopic.php?p=2272494
http://en.wikibooks.org/wiki/Java_Persistence/Basic_Attributes#LOBs.2C_BLOBs.2C_CLOBs_and_Serialization
http://community.jboss.org/wiki/HibernateCoreMigrationGuide30
[quote]Blob and Clob support - Hibernate now wraps Blob and Clob instances, to allow classes with a property of type Blob or Clob to be detached, serialized, deserialized, and passed to merge(). However, this means that the Blob or Clob cannot be cast to a vendor specific type (eg. oracle.sql.CLOB). You must use the getWrappedClob() or getWrappedBlob() methods:
clob = (oracle.sql.CLOB) ( (org.hibernate.lob.SerializableClob) foo.getText() ).getWrappedClob([/quote]
[quote=jakefrog]Talvez esses links te ajudem.
https://forum.hibernate.org/viewtopic.php?p=2272494
http://en.wikibooks.org/wiki/Java_Persistence/Basic_Attributes#LOBs.2C_BLOBs.2C_CLOBs_and_Serialization
http://community.jboss.org/wiki/HibernateCoreMigrationGuide30
[quote]Blob and Clob support - Hibernate now wraps Blob and Clob instances, to allow classes with a property of type Blob or Clob to be detached, serialized, deserialized, and passed to merge(). However, this means that the Blob or Clob cannot be cast to a vendor specific type (eg. oracle.sql.CLOB). You must use the getWrappedClob() or getWrappedBlob() methods:
clob = (oracle.sql.CLOB) ( (org.hibernate.lob.SerializableClob) foo.getText() ).getWrappedClob([/quote][/quote]
Em um dos links acima encontrei na documentação de migração do Hibernate a forma que se deve fazer a conversão dos objetos clob e blob.
Acabei adaptando para o meu programa assim:
Mas ao executar a exception que recebo é esta:
Erro na conexão com servidor :Failed to communicate. Problem during marshalling/unmarshalling; nested exception is:
java.io.NotSerializableException: org.hibernate.lob.ClobImpl - java.io.NotSerializableException: org.hibernate.lob.ClobImpl - [Ljava.lang.StackTraceElement;@c66375
Alguma sugestão ?