• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate, Inheritance and storing as file

 
Thomas Struntz
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I already posted this on hibernate forums but got no answer. So I'm for cross-posting but I would like to get an answer.

I want to subclass a class from a framework I'm using and persist it.
The superclass is rather complex and for reasons following I don't want to persist any of the fields from that superclass. How can that be done?
My subclass will mainly add an id for persistence and some methods.

The superclass is persisted as a "file" or "in the format of a file". In this case it means the data can be stored in a CLOB or large varchar column (varchar(7000) works fine for hsqldb and has way better performance than clob, done in jdbc).

So when an instance of this class is persisted, I would only like to persist this "file data" and the id(primary key, assigned by RDBMS).
When an instance should be created it reads the filedata from the database and creates the object from there.
Constructor would look something like MyClass(InputStream fileData, Long id) or MyClass(String fileData, Long id).

Any suggestions?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic