Hi All,
I am using Seam and hibernate and JPA. I am using Seam's EntityHome and EntityQuery classes to do the CRUD operations.
I have a question:
I have two entities with @Entity of JPA API.
I have created two lists of these two entities in each other and annotated like this:
Code:
@Table(name="CLASSA")
Class A{
@Id @GeneratedValue
@Column(name="CLASSA_ID")
private Long id;
@ManyToMany(cascade=CascadeType.PERSIST)
@JoinTable(name="CLSA_CLSB",
joinColumns = {
@JoinColumn(name = "CLASSA_ID")},
inverseJoinColumns = {
@JoinColumn(name = "QID")})
private List<ClassB> classesB= new ArrayList<ClassB>();
}
AND
Code:
@Table(name="CLASSB")
ClassB{
@Id @GeneratedValue
@Column(name="QID")
private Long id;
@ManyToMany
private List<ClassA> classesA;
}
I created the tables myself so instead of naming the jointable as : CLASSA_CLASSB i just named it CLSA_CLSB to keep it short
now the DB is already created, and when I deploy the application on JBOSS hibernate throws an exception that it is missing table: CLASSA_CLASSB,
why is it looking for CLASSA_CLASSB when I have already defined a JOINTABLE. now when i run this on an empty DB with
Code:
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
it does create the CLSA_CLSB with two fields as in the @MANYTOMANY annotation as well but it also throws an error that CLASSA_CLASSB cannot be created as Identifier (originally the CLASSA and CLASSB are appended with application name so it concatenates both table names which becoems tooo long).
i created the tables with create and then changed the value of the hibernate property to "Update" and I could work and the deployment was successful, BUT when i tried to REMOVE ClassB instances (I was able to create ClassB instances and store them in DB and update them ) it threw me the same error that it cannot find the CLASS_CLASSB table
why is it stuck on this table. why is it even trying to create it in the first place when i have already defined a JOINTABLE. If i keep the property of the hibernate as "validate" then it tries to find the CLASS_CLASSB table which I didnt make nor did i refer it anywhere.
I will really appreciate your help.
Thanks
Syed...