Bookmark Topic Watch Topic
  • New Topic

EJB3 Entity: how can I store an object instance?  RSS feed

 
Tong Wang
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello everyone,

I have an EJB3 entity bean like this:

where RuleModel is a POJO and its object graph could get very complex, so I don't want to map it to persistence, instead I want to directly store the object instance of RuleModel along with my Promotion entity bean.

I've been reading the EJB3 docs and it looks like there is a @Lob annotation for large objects, it could be either a CLOB or BLOB, depending on the type of the object.

So, for a BLOB, if I mark the RuleModel class as Serializable, can I persist it to DB and load it later on? Will it work? Anyone actually used @Lob this way?

As you know, there are tools for creating a mapping between Java objects and XML docs, this means you can convert your Java object instance to an XML string and then store it as a CLOB. Can someone please recommend a good Java-XML mapping framework?

Between the above two methods (if the first one works), which one is better in terms of easy to program/maintain and performance at runtime?

Your help will be greatly appreciated.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not duplicate threads.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!