You need to call configure() on your Configuration
object. You also need to call your hiberate config
file hibernate.cfg.xml or else tell it the name to use
in configure().
--Chris
--- John Olmstead <jolmstead2k@xxxxxxxxx> wrote:
> Scott & Chris,
>
> I have added the following config file to my classes
> directory and still get the same
> exception trace (hibernate.config.xml):
>
> <?xml version='1.0' encoding='utf-8'?>
> <!DOCTYPE hibernate-configuration PUBLIC
> "-//Hibernate/Hibernate Configuration DTD
> 2.0//EN"
>
>
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
>
> <hibernate-configuration>
>
> <!-- a SessionFactory instance listed as
> /jndi/name -->
> <session-factory
> name="java:comp/env/hibernate/SessionFactory">
>
> <!-- properties
> <property
>
name="connection.datasource">cintas/datasource/mlraDS</property>
> <property
>
name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>
> <property name="show_sql">true</property>
> <property name="use_outer_join">true</property>
> <property name="transaction.factory_class">
>
> net.sf.hibernate.transaction.JTATransactionFactory
> </property>
> <property
> name="transaction.manager_lookup_class">
>
>
net.sf.hibernate.transaction.WeblogicTransactionManagerLookup
> </property>
> <property
>
name="jta.UserTransaction">java:comp/UserTransaction</property>
> -->
> <!-- mapping files -->
> <mapping
> resource="ems/hibernate/HibernateCompany.hbm.xml"/>
> <mapping
> resource="ems/hibernate/HibernateServer.hbm.xml"/>
> <mapping
> resource="ems/hibernate/HibernateInstance.hbm.xml"/>
> </session-factory>
> </hibernate-configuration>
>
> Thanks Again!!!!
>
> John Olmstead
>
>
> --- smorgan@xxxxxxxx wrote:
>
> ---------------------------------
>
>
> Are your .hmb.xml files listed in your main
> hibernate config file? Many times, I've forgotten
> to add these after generating the hbm.xml files via
> xdoclet.
>
> Scott
>
>
> Chris Nelson <cnelson4eii@xxxxxxxxx>
> 07/28/2004 12:50 PM MST
>
> To: users@xxxxxxxxxx
> cc:
> bcc:
> Subject: Re: [cinjug-users] Hibernate Newbie
> Question
>
>
>
>
> It does look like it is not finding your .hbm.xml
> files. These files should be place next to the
> class
> files, ie the hbm file for class com.blah.Foo would
> go
> in the classes dir at com/blah/Foo.hbm.xml. I do
> this
> by calling xdoclet and telling it to generate into
> my
> source dir and then copy these files over to the
> classes directory in my compile target.
>
> Hibernated classes absolutely can be tested in a dev
> environment, but you may need to use a different
> configuration file to tell it to just connect thru
> JDBC and not get the connection from the datasource.
> Myself, I just run my junit test cases in the
> appserver locally using cactus and DBUnit and that
> way
> i just have one config file.
>
> --- John Olmstead <jolmstead2k@xxxxxxxxx> wrote:
> > Collegues;
> >
> > I have developed a demonstration application to
> use
> > hibernate and I'm trying to test this
> > application from a main method within an ide. I'm
> > getting the following error :
> >
> > net.sf.hibernate.MappingException: No persister
> for:
> > ems.hibernate.HibernateCompany
> > at
> >
>
net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:344)
> > at
> >
>
net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2686)
> > at
> >
>
net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1984)
> > at
> >
>
net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1916)
> > at
> >
>
ems.hibernate.EmsHibernateFacade.getServers(EmsHibernateFacade.java:70)
> > at
> >
>
ems.hibernate.EmsHibernateFacade.main(EmsHibernateFacade.java:36)
> > java.lang.NullPointerException
> > at
> >
>
ems.hibernate.EmsHibernateFacade.main(EmsHibernateFacade.java:37)
> >
> > I'm betting that the application does not see the
> > hbm.xml files I generated with XDoclet. How
> > do I get the application to see the hbm.xml files?
> > Can hibernate applications be tested from a
> > development environment? How are Hibernate Objects
> > referenced from within an application
> > server? I don't see and jndi code in any of the
> > examples I have seen.
> >
> > Relevant Application Artifacts Follow.
> >
> > Many Thanks and Much Appreciation;
> >
> > John Olmstead
> >
> >
> > Hibernate Facade:
> >
> > package ems.hibernate;
> >
> > import net.sf.hibernate.Session;
> > import net.sf.hibernate.HibernateException;
> > import net.sf.hibernate.cfg.Configuration;
> > import
> >
> com.xdocletbook.blog.exception.ApplicationException;
> >
> > import java.util.Collection;
> > import java.util.Iterator;
> >
> > /**
> > * Created by IntelliJ IDEA.
> > * User: tk21104
> > * Date: Jul 28, 2004
> > * Time: 1:11:05 PM
> > * To change this template use Options | File
> > Templates.
> > */
> > public class EmsHibernateFacade
> > {
> > private Session session = null;
> >
> > public EmsHibernateFacade()
> > {
> > try
> > {
> > session = new
> >
> Configuration().buildSessionFactory().openSession();
> > }
> > catch (HibernateException e)
> > {
> > e.printStackTrace();
> > }
> > }
> > public static void main(String[] args )
> > {
> > EmsHibernateFacade facade = new
> > EmsHibernateFacade();
> > Collection c = facade.getServers(new
> > Integer(9));
> > Iterator iter = c.iterator();
> > while (iter.hasNext())
> > {
> > HibernateServer server =
> > (HibernateServer)iter.next();
>
=== message truncated ===
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail
|