I have (finally) committed the code for EJB 2.0 CMR fields.  It took longer
than I thought mainly because Marc's update of the entity interceptor code
showed me a major flaw in my implementation when there is more then one
concurrent transaction. Anyway, it's in and you can start to play with it
now. I will follow up with quick docs later.  Here are some notes for now:

1.  All relation types in spec should work. I built a test suite based on
the test in the specification.

2. Relationships don't eager load (read-ahead).  I think I will add this in
the EJB-QL phase, as EJB-QL will have the same problem.

3. There are two mapping styles: table and foreign key. You specify which
style in the jbosscmp-jdbc.xml file as follows:

<relationships>
    <ejb-relation>
        <ejb-relation-name>AB_OneToMany_Bi_Table</ejb-relation-name>
        <mapping-style>table</mapping-style>
        <table-name>AB_OneToManyBi</table-name>
    </ejb-relation>

    <ejb-relation>
        <ejb-relation-name>AB_OneToMany_Bi_FK</ejb-relation-name>
        <mapping-style>foreign-key</mapping-style>
    </ejb-relation>
</relationships>

4. You can't currently override the names and other info of relation
columns. I will add the configuration code soon.

5. I added code to bind the local home into jndi (I needed it for testing).
Remember relationships are only allowed between local interfaces. Just add
local-jndi-name element to the entity element in the jboss.xml. An example
follows:

<entity>
    <ejb-name>B_ManyToOne_Uni_Table_EJB</ejb-name>

<local-jndi-name>relation/manyToOne/unidirectional/table/B</local-jndi-name>
</entity>


6. I implemented the relationships with an invocation interceptor (it was
necessary). See JDBCRelationInterceptor in the
org.jboss.ejb.plugins.cmp.jdbc.  In the future, the interceptor could be
made more generic for other persistence managers, but for now the code is
too new to do.

Check it out,

Dain Sundstrom


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to