Hello Forum,
hmm... - some views but no ideas - maybe not clear what I want?
I'm trying to be a bit more detailed:
Class Account:
Code:
@Entity
@Table(name = "account")
public class Account {
private long id;
private String username;
private String password;
... get- and set-methods skipped...
}
To be able to use this class in all sub projects all entity classes are packaged
in one "entity-business-jar file":
Code:
entity.jar
|- Account.class
|- ...
This entity.jar is deployed on the JBoss underneath the lib folder of the
used server instance:
Code:
jboss-root
|-deploy
|-workerEjb3-Project.ear
|-lib
|-entity.jar
|...
The worker project contains a class "RequestedData":
Code:
@Entity
@Table(name = "requested_data")
public class RequestedData {
private long id;
private Account account;
... get- and set-methods skipped...
}
After referencing the "Account" class explicitly in the persistence.xml file
of the "workerEjb3-Project.ear" project all necessary tables are created
by the hbm2ddl-auto feature.
The created tables are:
Code:
----------------------account----------------------------
| Field | Type
|----------------------------------------------------------
| id | bigint
| username | varchar(32)
| password | varchar(32)
-----------------------------------------------------------
----------------------requested_data-------------------
| Field | Type
|----------------------------------------------------------
| id | bigint
| account | tinyblob
-----------------------------------------------------------
But unfortunately that's not what I want - I would prefer:
Code:
----------------------account----------------------------
| Field | Type
|----------------------------------------------------------
| id | bigint
| username | varchar(32)
| password | varchar(32)
-----------------------------------------------------------
----------------------requested_data-------------------
| Field | Type
|----------------------------------------------------------
| id | bigint
| account | bigint <-- Foreign key
-----------------------------------------------------------
So I would like to tell the persitence manager that it shall store the "Account" related data in the "account" table and only keep a foreign key
to the id of the "Account" instance.
Hope that outlines the problem more precisely...
Best regards,
Henning Malzahn