Hibernate version: hibernate-3.0rc1, hibernate-annotations-3.0alpha3
I ran into a problem where it appears that you can't have two classes with the same name, even though the classes are in different packages. For example, I tried to do something similar to the following and it gave me an exception of "AnnotationException: Use of the same entity name twice".
The reason why I was trying to do something like this is because I want to have a Person class which is in a base package. This person class will be shared between several different projects. For example, I have one project having to do with reservations and another one having to do with job applications. In the reservations project, a person can have reservations. In the job applications project a person can have job applications. I wanted to make it so that the base level Person class didn't have references to either of these. These would be in the sub-packages. This way, the job applications application would depend on classes in the reservations project and vice versa.
I was thinking it would be nice if Hibernate were able to qualify the internally used names with the package name to avoid conflicts and to allow the use of the same class name in different packages.
The other thing that I was wondering about is that if the subclass Person class (renamed to Person2 to get it to work) didn't have any properties, if it would still create another table, or, if it would just use the base classes table. It appears to be the later which is what I was hoping for.
Code:
// Person.java in mypackage
package mypackage;
public class Person {
...
}
Code:
// Person.java in mypackage/subpackage
package mypackage.mysubpackage;
public class Person extends mypackage.Person {
...
}
Another thing that would be nice is if you add an annotated class to the configuration, that Hibernate automatically adds all the dependent classes.