Thanks Robert, I will take a look. 

Angela


________________________________
 From: Robert Lentz <rob...@teksolv.de>
To: Tapestry users <users@tapestry.apache.org> 
Sent: Thursday, May 16, 2013 9:40 PM
Subject: Re: Unknown entity and SessionFactory null
 

Angela,

have a look at

https://github.com/rlentz/tahi_jndi.

This is a very simple tapestry-hibernate-jndi-demo setup for using
hibernate in tapestry using tomcat or jetty.
The database/hibernate configuration is solely done via a jndi
environment without a hibernate.cfg.xml at all and automatically creates
test-data in development mode. The hibernate entity class PHEUser is
automatically retrieved from the entities packages.
Have a look at it and you might find the difference why it isn't working
for you.
Hope it is helpful.

Aloha
Robert

Andjela Djenic schrieb:
> 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
>  



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to