Application tab
Entity beans generated by JCodeBox typically maintain data held in a database. The entity bean needs a way to obtain a
connection to this database. In J2EE, connections are obtained from a DataSource resource reference that has been previously
configured in your application server (consult your application server's documentation for further details on creating resource
references).
A DataSource resource reference is accessed (i.e. by an entity bean) using the JNDI name that was assigned to it when it was
configured. Before using JCodeBox, you should create a DataSource resource reference for your database in your application server.
You should then set the Default DataSource JNDI name setting in JCodeBox to the JNDI name you assigned to the DataSource resource
reference.
When you create applications in JCodeBox, it will automatically set the applications' DataSource JNDI name to the value in
the Default DataSource JNDI name global setting. Then, when you create any entity beans in your application, the entity bean's
DataSource JNDI name will automatically be set to the application's DataSource JNDI name. In addition, JCodeBox can automatically
create a DataSource resource reference in the entity beans' resource references list based on its DataSource JNDI name.
In effect, you only have to set the DataSource JNDI name once (in global settings), and all future components (that need
DataSource objects i.e. entity beans) that you generate in JCodeBox can inherit this value.
If you change your database and create a new DataSource resource reference, again you only need to make the change in one place
in JCodeBox (global settings) and all future applications/entity beans that are created will use this new value.
JCodeBox also allows you to maintain a list of commonly used DataSource JNDI names making it easier to switch between names. To add/edit/delete from this list, click the button to the right of the default DataSource JNDI name dropdown box.
Tip
If you have matching tables in different databases and would like your application to access the table in a different database
(i.e. different from your Default DataSource resource reference) you can manually override the DataSource JNDI settings for an
individual entity bean. Note however, this does depend on your application server and bean persistence type and also raises
potential transaction issues.