If you know how to do the mapping in an .hbm.xml file, I'd recommend you do
it that way.  XDoclet is only provided as a convenience, it's not
required.  From the FAQ:


  - *Do I have to use XDoclet to generate my *.hbm.xml files? Is it
  possible to override a single hbm.xml file and create it by hand?*

If you have an @hibernate.class tag on a POJO - hibernatedoclet will
generate the mapping file into build/dao/gen. If you have a mapping file
(*.hbm.xml) file for your POJO in the src/dao/**/model/* directory, it will
*overwrite* the generated version. If you don't want to worry about the two
conflicting - just remove the @ sign from @hibernate.class in your POJO and
put your hbm.xml file in the model directory.

No build.xml modification are need for this to work. The "package-dao"
target will include these mapping files:

      <copy todir="${build.dir}/dao/gen">
          <fileset dir="src/dao" includes="**/*.xml"
excludes="**/*-${dao.type}.xml"/>
          <filterset refid="variables.to.replace"/>
      </copy>

If you want to get rid of the hibernatedoclet process, you can do that- but
make sure and run it first - and then copy all of the generated
hbm.xmlfiles into your
model directory.
http://raibledesigns.com/wiki/AppFuseSupport.html#ref-AppFuseSupport-9

HTH,

Matt

On 12/21/06, mxc <[EMAIL PROTECTED]> wrote:

Hi there,


I wish to do the following with xdoclets and appfuse.

I have a table called "Address" as follows

Address
======
id int,
street1 varchar(255),
street2 varchar(255) etc


I have tables

"Customer" and "Emploee"

Customer
======
id int,
company varchar(255),
etc

Employee
======
id int,
dept varchar(255),etc

Now a customer can have more than one address, such as shipping,delivery
etc
and an employee can have more than one ie. his/her own and next of kin

Now I join the "Customer" and "Employee" table via junction tables to the
"Address" table

i.e.

"Customer_Address_Junction_Table"
=================
emp_id int,
address_id int
type varchar(255)


"Employee_Address_Junction_Table"
=================
emp_id int,
address_id int
type varchar(255)

How can I do this using pojos and xdoclets? I have tried the following in
the employee and customer class.

        /**
* @hibernate.set lazy="true" outer-join="auto" inverse="true"
cascade="all-delete-orphan"
     * @hibernate.collection-key column="customer_id"
     * @hibernate.collection-many-to-many class="za.co.jumpingbean.Address
"
column="address_id"
        */

This just results a foreign key column being placed in the Address table
which is not ideal. Any pointers appreciated.

thanks

--
View this message in context:
http://www.nabble.com/How-to-implement-junction-tables-with-xdoclet--tf2865226s2369.html#a8006918
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
http://raibledesigns.com

Reply via email to