-->
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.  [ 3 posts ] 
Author Message
 Post subject: How do i declare a class as abstract ?
PostPosted: Tue Jun 01, 2004 9:35 am 
Newbie

Joined: Thu May 27, 2004 7:29 am
Posts: 2
How do i declare a class as abstract ?
The superclass Personin the following snip shold become abstract :
How do i manage that ?

The code :

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
    PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
   
   <class name="de.lmu.swep02.rsp.business.data.Person" table="Person" discriminator-value="P">
      
      <id name="id" type="string" unsaved-value="null" length="32">
         <generator class="uuid.hex"/>
      </id>
      
      <discriminator column="type" type="character"/>
      
      <property name="creationDate" type="date"/>
      
      <component name="name" class="de.lmu.swep02.rsp.business.data.Name" update="true" insert="true">
         <property name="title" column="title" type="string" />
         <property name="first" column="first" type="string" />
         <property name="last" column="last" type="string" />
      </component>
      
      <subclass name="de.lmu.swep02.rsp.business.data.ContractHolder" discriminator-value="C">
      
         <property name="address" column="address" type="de.lmu.swep02.rsp.business.data.Address" />
         <property name="taxOffice" column="taxOffice" type="de.lmu.swep02.rsp.business.data.TaxOffice" />
         
         <component name="bankData" class="de.lmu.swep02.rsp.business.data.BankData">
            <property name="blz" column="blz" type="string" />
            <property name="accountNumber" column="accountNumber" type="string" />
            <property name="bank" column="bank" type="string" />
         </component>
         
         <set name="contracts" inverse="true" lazy="true">
            <key column="contractHolder_id"/>
            <one-to-many class="de.lmu.swep02.rsp.business.data.Contract" />
         </set>
         
         <subclass name="de.lmu.swep02.rsp.business.data.Student" discriminator-value="S">
            <property name="matrnr" type="string"/>
         </subclass>
      
      </subclass>
      
      <subclass name="de.lmu.swep02.rsp.business.data.User" discriminator-value="U">
         
         <many-to-one name="usergroup" column="usergroup_id" class="de.lmu.swep02.rsp.business.data.Usergroup" />
         
         <component name="account" class="de.lmu.swep02.rsp.business.data.Account" update="true" insert="true">
            <property name="username" column="username" type="string" not-null="false" unique="false" update="true" insert="true" />
            <property name="password" column="password" type="string" not-null="false" unique="false" update="true" insert="true" />
         </component>
      
      </subclass>
   </class>

</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 01, 2004 11:21 am 
Regular
Regular

Joined: Wed May 12, 2004 3:03 am
Posts: 51
Location: France
Hi,

You don't need to declare a class as abstract in the mapping files... You just declare it in you java file...

Charles


Top
 Profile  
 
 Post subject: Making a class abstract
PostPosted: Wed Sep 01, 2004 7:38 pm 
Newbie

Joined: Wed Mar 24, 2004 7:40 pm
Posts: 18
I looked for this for a long time, so I hope it helps to put it here.

If you want codegen to create abstract classes for you, put the following tag just inside your <class> declaration:

Code:
<meta attribute="scope-class">public abstract</meta>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.