-->
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.  [ 2 posts ] 
Author Message
 Post subject: Failed to export DDL using SchemaExport !!!
PostPosted: Thu Dec 18, 2003 5:38 am 
Regular
Regular

Joined: Tue Nov 04, 2003 12:37 pm
Posts: 57
Hello,

The following hbm.xml is generated by XDoclet. But it failed to export SQL?

I don't know where caused the problem. It failed when generated with the Player.hbm.xml !!!!

The goal.hbm.xml is no problem, but the player.hbm.xml failed.
Is there any problem in defining those XDoclet tag? Those tags I defined as same as the example in the xdoclet samples.

Regard,
Eric


Code:
/**
* Player class
*
*
* @hibernate.class
*    table="player"
*    polymorphism="explicit"
*    mutable="false"
*
* @struts.form
*    extends="org.apache.struts.validator.ValidatorForm"
*    include-all="true"
*/
public class Player extends BaseObject {
   protected int playerId;
   protected String playerName;
   protected boolean playerStatus;
   protected List goals;

   public void setPlayerId(int playerId) {
      this.playerId = playerId;
   }

   /**
    * @hibernate.id
    *    column="playerId"
    *    generator-class="native"
    */
   public int getPlayerId() {
      return playerId;
   }

   public void setPlayerName(String playerName) {
      this.playerName = playerName;
   }

   /**
    * @hibernate.property
    *    column="playerName"
    *    not-null="true"
    */
   public String getPlayerName() {
      return playerName;
   }
   
   public void setPlayerStatus(boolean playerStatus) {
      this.playerStatus = playerStatus;
   }

   /**
    * @hibernate.property
    *    column="playerStatus"
    *    not-null="true"
    */
   public boolean getPlayerStatus() {
      return playerStatus;
   }
   
   public void setGoals(List goals) {
      this.goals = goals;
   }
   
   
   /**
    * @hibernate.list
    *  lazy="true"
    *  inverse="true"
    *  cascade="all"
    * @hibernate.jcs-cache
    *  usage="read-write"
    * @hibernate.collection-key
    *  column="playerId"
    * @hibernate.collection-index
    *  column="playerPos"
    * @hibernate.collection-one-to-many
    *  class="com.echows.football.model.Goal"
    * @return List
    */
   public List getGoals() {
      return goals;
   }
}


Code:
/**
* Goal class
*
*
* @hibernate.class
*    table="goal"
*
* @struts.form
*    extends="org.apache.struts.validator.ValidatorForm"
*    include-all="true"
*/
public class Goal {
   protected Date goalDate;
   protected Player player;
   protected int goalQuantity;
   protected int goalId;

   public void setGoalId(int goalId) {
      this.goalId = goalId;
   }

   /**
    * @hibernate.id
    *    generator-class="native"
    */   
   public int getGoalId() {
      return goalId;
   }
   

   public void setGoalDate(Date goalDate) {
      this.goalDate = goalDate;
   }

   /**
    * @hibernate.property
    *    not-null="true"
    */
   public Date getGoalDate() {
      return goalDate;
   }

   public void setGoalQuantity(int goalQuantity) {
      this.goalQuantity = goalQuantity;
   }

   /**
    * @hibernate.property
    *    not-null="true"
    */
   public int getGoalQuantity() {
      return goalQuantity;
   }

   public void setPlayer(Player player) {
      this.player = player;
   }

   /**
    *
    * @hibernate.many-to-one
    *    column="playerId"
    *    not-null="true"
    *    constraint="true"
    */
   public Player getPlayer() {
      return player;
   }
}



Code:
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
    <class
        name="com.echows.football.model.Player"
        table="player"
        polymorphism="explicit"
        dynamic-update="false"
        dynamic-insert="false"
        mutable="false"
    >

        <id
            name="playerId"
            column="playerId"
            type="int"
        >
            <generator class="native">
            </generator>
        </id>

        <property
            name="playerName"
            type="java.lang.String"
            update="true"
            insert="true"
            column="playerName"
            not-null="true"
        />

        <property
            name="playerStatus"
            type="boolean"
            update="true"
            insert="true"
            column="playerStatus"
            not-null="true"
        />

        <list
            name="goals"
            lazy="true"
            inverse="true"
            cascade="all"
        >
            <jcs-cache
                usage="read-write"
             />

              <key
                  column="playerId"
              />

              <index
                  column="playerPos"
              />

              <one-to-many
                  class="com.echows.football.model.Goal"
              />
        </list>

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Player.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>



Code:
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
    <class
        name="com.echows.football.model.Goal"
        table="goal"
        dynamic-update="false"
        dynamic-insert="false"
    >

        <id
            name="goalId"
            column="goalId"
            type="int"
        >
            <generator class="native">
            </generator>
        </id>

        <property
            name="goalDate"
            type="java.util.Date"
            update="true"
            insert="true"
            column="goalDate"
            not-null="true"
        />

        <property
            name="goalQuantity"
            type="int"
            update="true"
            insert="true"
            column="goalQuantity"
            not-null="true"
        />

        <many-to-one
            name="player"
            class="com.echows.football.model.Player"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            column="playerId"
            not-null="true"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Goal.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>



Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 18, 2003 8:37 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
stack trace

_________________
Emmanuel


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