-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate connection properties !
PostPosted: Tue Nov 11, 2003 1:52 am 
Newbie

Joined: Tue Nov 11, 2003 1:31 am
Posts: 1
Hi I'm using the Hibernate 1.2.3(I can't upgrade)

I'm trying to pass the conneciton properties by code ,but with no success.


here is the code

-----------------------------------------------------------------------

Code:
   
public static java.util.Properties getHibernateProperties(){
           
            pr=new java.util.Properties();
            String databasePath=Cafe.class.getResource("User.hbm.xml").getPath();
           
            for (int i=0;i<5;i++){
                java.io.File f=new java.io.File(databasePath);
                databasePath=f.getParent();
            }
            databasePath=databasePath+"\\data\\NETCafeDB";
            System.out.println(databasePath);
           
            pr.setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver");
            pr.setProperty("hibernate.connection.url", "jdbc:hsqldb:"+databasePath);
            pr.setProperty("hibernate.connection.username", "sa");
            pr.setProperty("hibernate.connection.password", "");
            pr.setProperty("hibernate.connection.pool_size", "0");
           
        return pr;
    }

-------------------------------------------------------------------------
then

Code:
                 Datastore ds=Hibernate.createDatastore()
                .storeClass(com.NETcafe.core.Objects.Inventory.class)
                .storeClass(com.NETcafe.core.Objects.User.class)
                .storeClass(com.NETcafe.core.Objects.Computer.class)
                .storeClass(com.NETcafe.core.Objects.Customer.class)
                .storeClass(com.NETcafe.core.Objects.cardItem.class)
                .storeClass(com.NETcafe.core.Objects.NETCardClass.class);
               
               
                sf= ds.buildSessionFactory(getHibernateProperties());
               
                new SchemaExport(ds).create(true, true); 

---------------------------------------------------------
I'm getting all kind of errors form this ,I still have the hibernate.properties file in the class path.


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

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.