Quantcast
Channel: Spring Community Forums - JMS
Viewing all articles
Browse latest Browse all 51

Oracle AQ: mapping String to CLOB with StructMapper

$
0
0
Hi all,
Today i tried to enqueue an Oracle_queue using JmsTemplete. My oracle object contains clob while my java object contains String. With the spring converter I got a Jms exception telling me that type is not identical with the struct attribute (means String to CLOB). What I did is implementing DatumMapper and override toDatum function, so like that I did convert String to Clob:
Function toDatum(......){
java.sql.Clob clob= connection.createClob();
clob.setString(1, objecToConvert.getStringAttrOne());
// here I create a StructDescriptor
STRUCT struct = new STRUCT(StructDescriptor type, java.sql.Connection conn, new Object[] {clob});
return struct;
}
But I don't like this solution because it's not clean and we need to create a mapper per object
Do you have please any genius idea more clean and loosely coopled ? Or si spring data offering some kind of jpa mapping Like Hibernate ...?
Tomorrow I will see if I can create an abstract factory to do generic mapping.
Regards

Viewing all articles
Browse latest Browse all 51

Latest Images

Trending Articles



Latest Images