In JBoss, everything is configurable. Newcomers to JBoss often get
disoriented. I know I was lost when I first started. I've had a couple
people ask me about basic JBoss configuration, so I thought I'd write up
something real quick to help point people in the right direction.
In JBoss (3.x) there are 2 configuration files that related to CMP
beans, jboss.xml and jbosscmp-jdbc.xml. (or jaws.xml if you are still
working in 2.4 land) If you've been working with JBoss, you should be
familiar with those. What most people don't realize is that those
files only tell half the story. JBoss provides system wide versions
of those files that contain system-wide defaults. In your conf
directory, you should find standardjboss.xml and
standardjboss-cmp.xml. Looking at this files will explain a lot of
the behaviour you are seeing in JBoss.
For example, if you've ever wondered why your application defaults
to the internal hypersonic database, just look at the default cmp
file. The default datasource definitions are right there, along with
all the database mapping details. What type does your java.sql.Date or
your java.lang.Boolean map to for SQL Server? How are locks and
constraints managed? It's all there for you to see. Of course you
can make changes to the defaults if you want to, but I've found that
it's usually better to override the values at the application level
instead of at the system level.
Even more interesting is standardjboss.xml. You can see the
interceptor chains and caching policies for your beans. You can also
see all the standard container configurations for beans. This is
incredibly useful. I had to deploy some BMP beans written for
weblogic in JBoss not long ago. These beans were written using
weblogic's shared database configuration. By default, JBoss will use
the Standard BMP EntityBean configuration for beans.
Without getting too technical that configuration uses commit
option A. (assumes exclusive database access) I needed to use commit
option B (shared database) so the beans would work like they did in
weblogic. By looking through standardjboss.xml, I found a
configuration that looked like what I wanted, Instance Per
Transaction BMP EntityBean. I just needed to refer to that
configuration in my jboss.xml file. Of course, if none of the
configurations worked, I could have taken the closest one and modified
it for my needs.
When working with JBoss, everything is exposed for you to view and
tinker with. At first it can be a bit overwhelming, especially when
much of JBoss isn't very well documented, but if you play around with it
will all start to make sense. Or so I've been told... :)