I'm getting an exception when I do that way. I'm not satisfied with solution to add entities in config file, since it should be done automatically, by convention. It actually worked fine few days ago, and I don't know which changes could disrupt that.
Thanks, Angela ________________________________ From: Boris Horvat <horvat.z.bo...@gmail.com> To: Tapestry users <users@tapestry.apache.org>; Andjela Djenic <andjel...@yahoo.com> Sent: Thursday, May 16, 2013 9:46 PM Subject: Re: Unknown entity and SessionFactory null Can you try adding in AppModule.java @Contribute(HibernateEntityPackageManager.class) public static void addHibernateEntityPackageManager(Configuration<String> configuration) { configuration.add("rs.fon.master.onlinelibrary.entities"); } (and remove the mapping tag from the xml). Since this is a student project if you are happy with the result then you dont have to. I am just curious as to why it is not working On Thu, May 16, 2013 at 9:42 PM, Andjela Djenic <andjel...@yahoo.com> wrote: <!DOCTYPE hibernate-configuration PUBLIC > "-//Hibernate/Hibernate Configuration DTD 3.0//EN" > "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> ><hibernate-configuration> > <session-factory> > > <property >name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> > <property >name="hibernate.connection.url">jdbc:mysql://localhost:3306/library</property> > > <property >name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> > <property name="hibernate.connection.username">root</property> > <property name="hibernate.connection.password">books</property> > > <property name="hbm2ddl.auto">update</property> > <property name="hibernate.show_sql">true</property> > > <property name="hibernate.format_sql">true</property> > <property >name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property> > > <property >name="hibernate.current_session_context_class">thread</property> > > <mapping class="rs.fon.master.onlinelibrary.entities.City"/> > </session-factory> ></hibernate-configuration> > >I added only one entity to try if it works. > >________________________________ > From: Boris Horvat <horvat.z.bo...@gmail.com> >To: Tapestry users <users@tapestry.apache.org>; Andjela Djenic ><andjel...@yahoo.com> >Sent: Thursday, May 16, 2013 9:32 PM > >Subject: Re: Unknown entity and SessionFactory null > > >Can you provide hibernate.cfg.xml now? > > > >On Thu, May 16, 2013 at 9:28 PM, Andjela Djenic <andjel...@yahoo.com> wrote: > >> I added entity class in hibernate.cfg.xml and it works. I don't get why >> Tapestry won't automatically see my entities package. >> >> Thanks for the help folks! >> >> Angela >> >> >> ________________________________ >> From: Lenny Primak <lpri...@hope.nyc.ny.us> >> To: Tapestry users <users@tapestry.apache.org> >> Sent: Thursday, May 16, 2013 9:14 PM >> Subject: Re: Unknown entity and SessionFactory null >> >> >> I don't know about Hibernate, but JPA has an option to either scan for all >> the entities, >> or provide them in configuration. Perhaps there is the same thing for >> Hibernate, >> or it's turned off somewhere.... >> >> On May 16, 2013, at 3:10 PM, Boris Horvat wrote: >> >> > I would be more interested in seeing why doesn't this work out of the >> box. >> > I also dont provide entities in config.xml instead I let tapestry grab >> them >> > from my package... >> > >> > >> > On Thu, May 16, 2013 at 8:42 PM, Ken in Nashua <kcola...@live.com> >> wrote: >> > >> >> Hi Angela, >> >> >> >> Looks liek you didnt specify any entities in your hibernate cfg mapping >> >> file. >> >> >> >> If you model an entity under your model/entity package, yes you need to >> >> tell your AppModule.JAVA about that directory... >> >> >> >> But you also need to tell hibernate about those entities. >> >> >> >> We do this by specifying them in our hibernate.cfg.xml >> >> >> >> Here is mine.. >> >> >> >> >> >> >> >> <?xml version="1.0" encoding="UTF-8"?> >> >> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate >> >> Configuration DTD 3.0//EN" >> >> " >> http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd >> >> "> >> >> <hibernate-configuration> >> >> <session-factory> >> >> <!-- for more Database configuration options check: >> >> http://org.tynamo.examples.pphl.org/Sample+database+configurations --> >> >> <property >> >> >> name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> >> >> <property >> >> >> name="hibernate.connection.url">jdbc:mysql://localhost:3306/thibernatetest?autoReconnect=true</property> >> >> <property >> >> name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> >> >> <property name="hibernate.connection.username">root</property> >> >> <property name="hibernate.connection.password">admin</property> >> >> <property name="hbm2ddl.auto">update</property> >> >> <property name="hibernate.show_sql">false</property> >> >> <property name="hibernate.format_sql">true</property> >> >> <property name="hibernate.connection.pool_size">90</property> >> >> <property name="autoReconnect">true</property> >> >> >> >> <property name="hibernate.c3p0.min_size">5</property> >> >> <property name="hibernate.c3p0.max_size">20</property> >> >> <property name="hibernate.c3p0.timeout">300</property> >> >> <property name="hibernate.c3p0.max_statements">50</property> >> >> <property name="hibernate.c3p0.idle_test_period">3000</property> >> >> <property >> >> >> name="hibernate.connection.provider_class">org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider</property> >> >> <property >> >> >> name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property> >> >> >> >> >> >> <mapping class="org.tynamo.common.model.HibernateEntity"/> >> >> >> >> <mapping class="org.tynamo.examples.pphl.model.AdminLayout"/> >> >> <mapping class="org.tynamo.examples.pphl.model.PhotoGroup"/> >> >> <mapping class="org.tynamo.examples.pphl.model.PhotoGroupPhoto"/> >> >> <mapping class="org.tynamo.examples.pphl.model.UploadableMedia"/> >> >> <mapping class="org.tynamo.examples.pphl.model.Person"/> >> >> <mapping class="org.tynamo.examples.pphl.model.Sponsor"/> >> >> <mapping class="org.tynamo.examples.pphl.model.BroadCast"/> >> >> <mapping class="org.tynamo.examples.pphl.model.Coach"/> >> >> <mapping class="org.tynamo.examples.pphl.model.Demographics"/> >> >> <mapping class="org.tynamo.examples.pphl.model.Director"/> >> >> <mapping class="org.tynamo.examples.pphl.model.HitCounter"/> >> >> <mapping class="org.tynamo.examples.pphl.model.League"/> >> >> <mapping class="org.tynamo.examples.pphl.model.MetaTag"/> >> >> <mapping class="org.tynamo.examples.pphl.model.Officer"/> >> >> <mapping class="org.tynamo.examples.pphl.model.Organization"/> >> >> <mapping class="org.tynamo.examples.pphl.model.Payment"/> >> >> <mapping class="org.tynamo.examples.pphl.model.Player"/> >> >> <mapping class="org.tynamo.examples.pphl.model.PlayerStats"/> >> >> <mapping class="org.tynamo.examples.pphl.model.TeamStats"/> >> >> <mapping class="org.tynamo.examples.pphl.model.Inquiry"/> >> >> <mapping class="org.tynamo.examples.pphl.model.Team"/> >> >> <mapping class="org.tynamo.examples.pphl.model.Year"/> >> >> >> >> </session-factory> >> >> </hibernate-configuration> >> >> >> >> >> > >> > >> > >> > >> > -- >> > Sincerely >> > *Boris Horvat* >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> > > > >-- >Sincerely >*Boris Horvat* -- Sincerely Boris Horvat