-->
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.  [ 5 posts ] 
Author Message
 Post subject: table creation by jboss
PostPosted: Thu Nov 20, 2003 12:45 pm 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
Hey,

i search the whole day, but i still don't know what to do,
that the tables i define in the hibernate class with xdoclet tags are automatically createt!

i have my class:
Code:
/**
* @author jm
* @hibernate.class  table="KVT"
*/
public class KeyValueTuple {

   private Long uniqueSequence;
   private String Tkey;
   private String value; //temporary String (->Object)
   
   public KeyValueTuple() {
      
   }

   public void setUniqueSequence(Long puniqueSequence) {
      uniqueSequence=puniqueSequence;
      }


   /**@hibernate.id  generator-class="native" */
   public Long getUniqueSequence() {
      return uniqueSequence;
   }

   /**@param pKey
    *
    * */
   public void setTKey(String pKey) {
      Tkey = pKey;
   }
   /**
    * @hibernate.property
    * @return String
    */
   public String getTKey() {
      return Tkey;
   }

   /**  @param pValue */
   public void setValue(String pValue) {
      value = pValue;
   }

the generated mapping:
Code:
<?xml version="1.0"?>

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

<hibernate-mapping>
    <class
        name="org.weta.jas.hibernate.KeyValueTuple"
        table="KVT"
    >

        <id
            name="uniqueSequence"
            column="uniqueSequence"
            type="java.lang.Long"
            unsaved-value="any"
        >
            <generator class="native">
            </generator>
        </id>

        <property
            name="TKey"
            type="java.lang.String"
            column="TKey"
        />

        <property
            name="value"
            type="java.lang.String"
            column="value"
        />

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

    </class>

</hibernate-mapping>


the jboss-service.xml
Code:
<server>
<mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateFactory,
                            name=HibernateFactory">
    <depends>jboss.jca:service=RARDeployer</depends>
    <depends>jboss.jca:service=LocalTxCM,name=WetaDS</depends>
    <!-- Make it deploy ONLY after DataSource had been started -->
    <attribute name="MapResources">mappings/Attribute.hbm.xml</attribute>
    <attribute name="JndiName">java:/hibernate/HibernateFactory</attribute>
    <attribute name="Datasource">java:/WetaDS</attribute>
    <attribute name="Dialect">net.sf.hibernate.dialect.MySQLDialect</attribute>
    <attribute name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionFactory</attribute>
    <attribute name="TransactionManagerLookupStrategy">net.sf.hibernate.transaction.JBossTransactionManagerLookup</attribute>
    <attribute name="UseOuterJoin">false</attribute>
    <attribute name="ShowSql">false</attribute>
    <attribute name="UserTransactionName">java:/UserTransaction</attribute>
</mbean>
</server>


and the hibernate-configuration:
Code:
<hibernate-configuration>

    <session-factory>
        <!-- Use a Tomcat JNDI datasource -->
        <property name="connection.datasource">java:/WetaDS</property>
        <property name="show_sql">false</property>
        <property name="use_outer_join">true</property>
        <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>

        <mapping resource="mappings/KeyValueTuple.hbm.xml"/>

    </session-factory>

</hibernate-configuration>


i deploy my .sar in jboss, but the tables won't be created
Can anybody say , what to do?

thanx
N8chtschwaermer


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2003 1:11 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
There is no option to have the tables be generated automatically. The only thing you could do would be write something yourself using schemaexport / update, but there is no existing solution for automatical table generation yet, AFAIK


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2003 1:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Actually, in 2.1 you can set the hibernate.hbm2ddl.auto property.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 20, 2003 1:18 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Oh really? It gets nicer every day :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 12:12 pm 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
Thanks a lot!
I thought i get mad...

Johannes


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