I have existing (legacy) DB schema (for simplificity, just two tables, CustomerEJBTable & AccountEJBTable):
So, I do not want to allow JBoss to create db tables.
At the database level, there is no strictly defined foreign key constraint,
but, in fact, CustomerEJBTable.Account_pmPrimaryKey
points to the primary key of the AccountEJBTable
Further, in the customerEJB, I have one cmr field, named 'account'.
I want to establish one-to-one unidirectional relationship between customerEJB and accountEJB
Here is extract from ejb-jar.xml & jbosscmp-jdbc.xml:
And now, in the CustomerEJB.ejbPostCreate(), I have following code,
which just creates AccountEJB entity:
InitialContext ic = new InitialContext();
AccountLocalHome alh = (AccountLocalHome)
AccountLocal account = alh.create(AccountLocalHome.Active);
// where is 'account' - one cmr field in the CustomerEJB
At this moment, please take a look at following line from my JBoss
INSERT INTO ACCOUNTEJBTABLE (PMPRIMARYKEY, STATUS, CustomerEJB_account)
VALUES (?, ?, ?)
Please, notice last column in the insert statement: CustomerEJB_account
Q1: This mysterious column does not exists in AccountEJBTable, so, why
JBoss attempts to store some value in this column ?
Of course, my JDBC driver raises SQLException:
It looks like problem with jbosscmp-jdbc.xml, or not ?
Q2: What I should to do, to avoid this problem ? I cannot believe that I must to extend my database tables with this strange column names, and unknown types :((
By the way, I have a lot of legacy database tables....
-thanks in advance ....