-
1. Re: How to map EJB names to DB table names of my choosing?
andyjeff Dec 19, 2002 3:46 PM (in response to fumeishi)Hi,
with JBoss you need a file jbosscmp-jdbc.xml
Here's a snippet of the types of things to include ... (look in the DTD file referenced for the definition).
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jbosscmp-jdbc PUBLIC
"-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN"
"http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">
<jbosscmp-jdbc>
java:/DefaultDS
<datasource-mapping>Hypersonic SQL</datasource-mapping>
<enterprise-beans>
<!-- AccountBean DB table mapping -->
<ejb-name>AccountBean</ejb-name>
<create-table>true</create-table>
<remove-table>false</remove-table>
<table-name>WebShopAccount</table-name>
<cmp-field>
<field-name>id</field-name>
<column-name>Id</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(40)</sql-type>
</cmp-field>
<cmp-field>
<field-name>name</field-name>
<column-name>Name</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(50)</sql-type>
</cmp-field>
</enterprise-beans>
</jbosscmp-jdbc>
So you can specify the DB table name, and the column names, the SQL types (this is optional), etc.
HTH