I just ran into the same issue..  I am using the Avalon wrapper, and instead
of loading up a hibernate.cfg.xml, I have the xml inside my avalon config
file.  The wrapper just picks up the xml and then feeds it to Hibernate.
But I'm getting the same exception.  It is somewhat misleading b/c
everything continues to work.

Eric

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> BINGHAM, EARL (SBCSI)
> Sent: Thursday, October 30, 2003 8:54 PM
> To: '[EMAIL PROTECTED]'
> Subject: [Hibernate] Hibernate Setup without hibernate.cfg.xml file
>
>
>
> I have a number of classes that I wanted to all have share
> the same setup
> for OR Mapping. That way each class could setup its own
> session and persist
> in different ways.
>
> For example:
>
>    public void setupHibernate(List mapFiles)
>     {
>         try {
>               Properties hibernateConfig = new Properties();
>               hibernateConfig.setProperty("connection.url", myvalue);
>               hibernateConfig.setProperty("show_sql", "false");
>               hibernateConfig.setProperty("dialect", myDialect);
>             Configuration myConfig = new
> Configuration().setProperties(
> hibernateConfig );
>             Properties props = new Properties();
>             for(Iterator it = mapFiles.iterator(); it.hasNext(); ) {
>                 String mapFile = (String)it.next();
>                 System.out.println(" map file = " + mapFile);
>                 myConfig.addFile( mapFile );
>             }
>             _sessionFactory =
> myConfig.configure().buildSessionFactory();
>         } catch(Exception e) {
>             throw new RuntimeException("Hibernate error
> occured in initial
> session opening", e);
>         }
>       }
>
> Then I get the following error:
>
> 13:58:40,362  INFO Configuration:694 - Configuration resource:
> /hibernate.cfg.xml
> 13:58:40,364  WARN Configuration:698 - /hibernate.cfg.xml not found
> ASIAdapter: main: Exception Caught:
> java.lang.RuntimeException: Hibernate
> error occured in initial session \
> Opening
>
> Is there a way to not have to use a hibernate.cfg.xml file? I
> just want to
> setup the properties for the sessionfactory on my own.
>
> Earl
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive?  Does it
> help you create better code?   SHARE THE LOVE, and help us help
> YOU!  Click Here: http://sourceforge.net/donate/
> _______________________________________________
> hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to