3 Replies Latest reply on Jul 28, 2005 10:20 AM by Alan Ho

    EJB3 Tutorial - Entity Bean

    Alan Ho Newbie

      I test run the entity bean and evertyting works fine. The PURCHASE_ORDER and LINEITEM tables were created in the Hypersonic database with records. Can some one explain what I have obsevered?

      1. Removing the tutorial.ejb3 from the deploy directory will remove the PURCHASE_ORDER and LINEITEM tables in the Hypersonic database. What if I created some data in the tables, make an additional column (allow null values) in LINEITEM table, remove the tutorial.ejb3 from the deploy directory, re-build the the example and re-deploy. All my previous data were gone. In actual production environment, how should we handle such situtation?

        • 1. Re: EJB3 Tutorial - Entity Bean
          Shivani Sahi Newbie

          Hi,
          My tables are saved in the db ..they are there..but i still keep getting the userid as null when i give in the username and the password at the client..the table contains all 3 fields.I am unable to retrieve any information frm the db basically.PLease help.

          Thank you.

          • 2. Re: EJB3 Tutorial - Entity Bean
            Zhou John Newbie

            take a look at META-INF/persistence.xml,the property hibernate.hbm2ddl.auto is the key to create or update or create_drop the tables.if u set it create_drop,ur tables will be deleted after undeploy the ejb3.ps,if u can't find this property,take a look at server/all/deploy/ejb3.deploy/META-INF/persistence.properties.

            • 3. Re: EJB3 Tutorial - Entity Bean
              Alan Ho Newbie

              Thanks catton2000. In my server\default\deploy\ejb3.deployer\META-INF\ folder the contents of the persistence.xml is shown below. I guess the create-drop says it all.

              I would like to implement a persistence.xml file for MySQL database. Do you know an example anywhere?

              hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup
              hibernate.connection.release_mode=after_statement
              hibernate.transaction.flush_before_completion=false
              hibernate.transaction.auto_close_session=false
              hibernate.query.factory_class=org.hibernate.hql.ast.ASTQueryTranslatorFactory
              hibernate.hbm2ddl.auto=create-drop
              #hibernate.hbm2ddl.auto=create
              hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
              # Clustered cache with TreeCache
              #hibernate.cache.provider_class=org.jboss.ejb3.entity.TreeCacheProviderHook
              #hibernate.treecache.mbean.object_name=jboss.cache:service=EJB3EntityTreeCache
              hibernate.connection.datasource=java:/DefaultDS
              hibernate.dialect=org.hibernate.dialect.HSQLDialect
              javax.persistence.provider=org.hibernate.ejb.HibernatePersistence