Hibernate version:3.2
Mapping documents:not appliable
Code between sessionFactory.openSession() and session.close():not applicable
Full stack trace of any exception that occurs: none
Name and version of the database you are using: not applicable
The generated SQL (show_sql=true):not applicable
Debug level Hibernate log excerpt:none
Hi hibernate team,
It's been almost 3 years that I develop using hibernate, you have a really great product and ideas on how to resolve problems.
Today I'm creating a new product for my own starting business. So I have less time constraints and orders on how I should do things. So naturally as a self respecting developer, I wanted to develop reusable components.
You might say, why a so long introduction? : for 3 years I didn't ask any question on the forum ;-)
So let's begin:
The idea is to create a class that gives to any subclass the behaviour of archiving it self (different versions with timestamps, notes and the archiving performer). Let's call this base class Archivable, and its different timestamped entries: ArchiveEntry
Here's an attempt of text UML
___________________
| Archivable |
|__________________|
^ 1
|
|
| 1
v__________________
| ArchiveEntry |
| ------------------------ |
|-created : Date |
|-invalidated : Date |
|-performer : Person |
|__________________|
The idea is to flag ArchiveEntry with @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) so we can have a different index of entries for every Archivable subclass.
Let's give an example: a Student (subclass of Archivable) that has a property 'grade' will have a StudentArchiveEntry every time its grade has evolved, so we can see all his cursus and who gave him every diploma.
The problem when I create a strucutre like this is that the database schema is created successfully, but when queries are made, there's a disaccordance in indexes.
here are my classes anotations:
@Entity
@IdClass(ArchiveId.class)
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class ArchiveEntry
implements Serializable {
...}
@MappedSuperclass
@IdClass(ArchiveId.class)
public abstract class Archivable<T extends ArchiveEntry>
implements Serializable {
...}
@Entity
public class BasicPerson extends ArchiveEntry {
...}
Can you please help me find annotation is wrong? maybe it isn't the way I should resolve it at all...
Regards,
Zied
|