-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Where do I put my XDoclet hibernate tags?
PostPosted: Mon Apr 26, 2004 3:44 pm 
Newbie

Joined: Mon Jan 26, 2004 4:13 pm
Posts: 5
Ok,

I am generating my mapping files using XDoclet.

I have 30 db tables that have the same two columns: code and description.

I have 30 subclasses that map to the different tables.

I have one base class that maps to nothing but contains the code and description attributes.


Question:

Where do I put my XDoclet comments? My subclasses simply inherit the base class?


Top
 Profile  
 
 Post subject: Re: Where do I put my XDoclet hibernate tags?
PostPosted: Mon Apr 26, 2004 11:27 pm 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
Marco wrote:
My subclasses simply inherit the base class?


Yes. Subclasses will have a XDoclet @hibernate.class or some such.


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2004 12:54 am 
Beginner
Beginner

Joined: Thu Jan 08, 2004 4:40 am
Posts: 48
Location: Bangkok, Thailand
I hope this might help you, this is parent class
Code:
package com.netplus.workstation.pprincess.hibernate.entity;

import com.netplus.workstation.pprincess.Address;
import java.io.Serializable;
/**
* @castor.class
* @hibernate.class
*  table="ADDRESS"
*  discriminator-value="H"
* @hibernate.discriminator column="type" type="character"
*/

public class HibernateAddress implements Address, Serializable{
    protected Long addressId;
    protected Long memberId;
    protected String addressNo;
    protected String street;
    protected String district;
    protected String city;
    protected String state;
    protected int country;
    protected String postCode;
    protected String phone;
    protected String fax;
   
    public HibernateAddress() {
    }
   
    /**
     * @castor.field   
     *      type = "java.lang.Long"
     * @castor.field-xml
     *      name = "addressId"
     *      node = "attribute"
     * @hibernate.id
     *  generator-class="native"
     *  unsaved-value="0"
     */
    public Long getAddressId(){
        return this.addressId;
    }
    public void setAddressId(Long addressId){
        this.addressId = addressId;
    }
   
    /**
     * @castor.field   
     *      type = "java.lang.Long"
     * @castor.field-xml
     *      name = "memberId"
     *      node = "element"
     * @hibernate.property
     */     
    public Long getMemberId(){
        return this.memberId;
    }   
    public void setMemberId(Long memberId){
        this.memberId = memberId;
    }   

    /**
     * @castor.field   
     *      type = "java.lang.String"
     * @castor.field-xml
     *      name = "addressNo"
     *      node = "element"
     * @hibernate.property
     */     
    public String getAddressNo(){
        return this.addressNo;
    }
    public void setAddressNo(String addressNo){
        this.addressNo = addressNo;
    }
   
    /**
     * @castor.field   
     *      type = "java.lang.String"
     * @castor.field-xml
     *      name = "street"
     *      node = "element"
     * @hibernate.property
     */     
    public String getStreet(){
        return this.street;
    }
    public void setStreet(String street){
        this.street = street;
    }
   
    /**
     * @castor.field   
     *      type = "java.lang.String"
     * @castor.field-xml
     *      name = "district"
     *      node = "element"
     * @hibernate.property
     */     
    public String getDistrict(){
        return this.district;
    }
    public void setDistrict(String district){
        this.district = district;
    }
   
    /**
     * @castor.field   
     *      type = "java.lang.String"
     * @castor.field-xml
     *      name = "city"
     *      node = "element"
     * @hibernate.property
     */   
    public String getCity(){
        return this.city;
    }
    public void setCity(String city){
        this.city = city;
    }
   
    /**
     * @castor.field   
     *      type = "java.lang.String"
     * @castor.field-xml
     *      name = "state"
     *      node = "element"
     * @hibernate.property
     */   
    public String getState(){
        return this.state;
    }
    public void setState(String state){
        this.state = state;
    }
   
    /**
     * @castor.field   
     *      type = "int"
     * @castor.field-xml
     *      name = "country"
     *      node = "element"
     * @hibernate.property
     */   
    public int getCountry(){
        return this.country;
    }
    public void setCountry(int country){
        this.country = country;
    }
   
    /**
     * @castor.field   
     *      type = "java.lang.String"
     * @castor.field-xml
     *      name = "postCode"
     *      node = "element"
     * @hibernate.property
     */   
    public String getPostCode(){
        return this.postCode;
    }
    public void setPostCode(String postCode){
        this.postCode = postCode;
    }
   
    /**
     * @castor.field   
     *      type = "java.lang.String"
     * @castor.field-xml
     *      name = "phone"
     *      node = "element"
     * @hibernate.property
     */   
    public String getPhone(){
        return this.phone;
    }
    public void setPhone(String phone){
        this.phone = phone;
    }
   
    /**
     * @castor.field   
     *      type = "java.lang.String"
     * @castor.field-xml
     *      name = "fax"
     *      node = "element"
     * @hibernate.property
     */   
    public String getFax(){
        return this.fax;
    }
    public void setFax(String fax){
        this.fax = fax;
    }
}

_________________
<name>arin</name>
<at>netplus software</at>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2004 12:56 am 
Beginner
Beginner

Joined: Thu Jan 08, 2004 4:40 am
Posts: 48
Location: Bangkok, Thailand
this is child class,
Code:
package com.netplus.workstation.pprincess.hibernate.entity;

import com.netplus.workstation.pprincess.OfficeAddress;
import com.netplus.workstation.pprincess.hibernate.entity.HibernateAddress;

/**
* @castor.class
* @hibernate.subclass table="ADDRESS" discriminator-value="O"
*
*/
public class HibernateOfficeAddress extends HibernateAddress implements java.io.Serializable, OfficeAddress {
   
   protected Long memberIdOff;
   protected String companyName;
   protected String buildingName;
   protected String floor;
   protected String contactName;
   
   public HibernateOfficeAddress() {
   }
   
   
       /**
        * @castor.field   
   *      type = "java.lang.Long"
   * @castor.field-xml
   *      name = "memberIdOff"
   *      node = "attribute"
   * @hibernate.property
   */       
   public Long getMemberIdOff(){
      return this.memberIdOff;
   }
   public void setMemberIdOff(Long memberIdOff){
      this.memberIdOff = memberIdOff;
   }
   
       /**
        * @castor.field   
   *      type = "java.lang.String"
   * @castor.field-xml
   *      name = "companyName"
   *      node = "element"
   * @hibernate.property
   */       
   public String getCompanyName(){
      return this.companyName;
   }
   public void setCompanyName(String companyName){
      this.companyName = companyName;
   }
       
       /**
        * @castor.field   
   *      type = "java.lang.String"
   * @castor.field-xml
   *      name = "buildingName"
   *      node = "element"
   * @hibernate.property
   */
   public String getBuildingName(){
      return buildingName;
   }
   public void setBuildingName(String buildingName){
      this.buildingName = buildingName;
   }
   
       /**
        * @castor.field   
   *      type = "java.lang.String"
   * @castor.field-xml
   *      name = "floor"
   *      node = "element"
   * @hibernate.property
   */
       public String getFloor(){
      return floor;
   }
   public void setFloor(String floor){
      this.floor = floor;
   }
   
   
       /**
        * @castor.field   
        *      type = "java.lang.String"
        * @castor.field-xml
        *      name = "contactName"
        *      node = "element"
        * @hibernate.property
        */
        public String getContactName(){
           return this.contactName;
        }
       
        public void setContactName(String contactName){
           this.contactName = contactName;
        }
}

_________________
<name>arin</name>
<at>netplus software</at>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.