Unknown entity and SessionFactory null
Hi, I'm newbie in Tapestry and Hibernate and I cannot realize why Hibernate don't see my entities. My entity classes have @Entity annotation and are in entities package. Dependencies for hibernate-tapestry that I use: dependency groupIdorg.apache.tapestry/groupId artifactIdtapestry-core/artifactId version5.3.6/version /dependency dependency groupIdorg.apache.tapestry/groupId artifactIdtapestry-hibernate-core/artifactId version5.3.6/version /dependency The info from console that I get: [ERROR] TapestryModule.ClientDataEncoder The symbol 'tapestry.hmac-passphrase' has not been configured. This is used to configure hash-based message authentication of Tapestry data stored in forms, or in the URL. You application is less secure, and more vulnerable to denial-of-service attacks, when this symbol is not configured. [DEBUG] components.Cities [ENTER] onPrepareForRender() [INFO] common.Version Hibernate Commons Annotations 3.2.0.Final [INFO] cfg.Environment Hibernate 3.6.0.Final [INFO] cfg.Environment hibernate.properties not found [INFO] cfg.Environment Bytecode provider name : javassist [INFO] cfg.Environment using JDK 1.4 java.sql.Timestamp handling [INFO] cfg.Configuration configuring from resource: /hibernate.cfg.xml [INFO] cfg.Configuration Configuration resource: /hibernate.cfg.xml [WARN] util.DTDEntityResolver recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide! [INFO] cfg.Configuration Configured SessionFactory: null [INFO] cfg.Configuration Hibernate Validator not found: ignoring [INFO] search.HibernateSearchEventListenerRegister Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled. [INFO] connection.DriverManagerConnectionProvider Using Hibernate built-in connection pool (not for production use!) [INFO] connection.DriverManagerConnectionProvider Hibernate connection pool size: 20 [INFO] connection.DriverManagerConnectionProvider autocommit mode: false [INFO] connection.DriverManagerConnectionProvider using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/library [INFO] connection.DriverManagerConnectionProvider connection properties: {user=root, password=} [INFO] cfg.SettingsFactory Database - name : MySQL version : 5.5.24-log major : 5 minor : 5 [INFO] cfg.SettingsFactory Driver - name : MySQL-AB JDBC Driver version : mysql-connector-java-5.1.23 ( Revision: ${bzr.revision-id} ) major : 5 minor : 1 [INFO] dialect.Dialect Using dialect: org.hibernate.dialect.MySQLDialect [INFO] transaction.TransactionFactoryFactory Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory [INFO] transaction.TransactionManagerLookupFactory No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) [INFO] cfg.SettingsFactory Automatic flush during beforeCompletion(): disabled [INFO] cfg.SettingsFactory Automatic session close at end of transaction: disabled [INFO] cfg.SettingsFactory JDBC batch size: 15 [INFO] cfg.SettingsFactory JDBC batch updates for versioned data: disabled [INFO] cfg.SettingsFactory Scrollable result sets: enabled [INFO] cfg.SettingsFactory JDBC3 getGeneratedKeys(): enabled [INFO] cfg.SettingsFactory Connection release mode: auto [INFO] cfg.SettingsFactory Maximum outer join fetch depth: 2 [INFO] cfg.SettingsFactory Default batch fetch size: 1 [INFO] cfg.SettingsFactory Generate SQL with comments: disabled [INFO] cfg.SettingsFactory Order SQL updates by primary key: disabled [INFO] cfg.SettingsFactory Order SQL inserts for batching: disabled [INFO] cfg.SettingsFactory Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory [INFO] ast.ASTQueryTranslatorFactory Using ASTQueryTranslatorFactory [INFO] cfg.SettingsFactory Query language substitutions: {} [INFO] cfg.SettingsFactory JPA-QL strict compliance: disabled [INFO] cfg.SettingsFactory Second-level cache: enabled [INFO] cfg.SettingsFactory Query cache: disabled [INFO] cfg.SettingsFactory Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory [INFO] cfg.SettingsFactory Optimize cache for minimal puts: disabled [INFO] cfg.SettingsFactory Structured second-level cache entries: disabled [INFO] cfg.SettingsFactory Echoing all SQL to stdout [INFO] cfg.SettingsFactory Statistics: disabled [INFO] cfg.SettingsFactory Deleted entity synthetic identifier rollback: disabled [INFO] cfg.SettingsFactory Default entity-mode: pojo [INFO] cfg.SettingsFactory Named query checking : enabled [INFO] cfg.SettingsFactory Check Nullability in Core (should be disabled when Bean Validation is on): enabled [INFO] impl.SessionFactoryImpl building session factory [INFO]
Unknown entity and SessionFactory null
Here is my hibernate.cfg.xml file: !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_classcom.mysql.jdbc.Driver/property property name=hibernate.connection.urljdbc:mysql://localhost:3306/library/property property name=hibernate.dialectorg.hibernate.dialect.MySQLDialect/property property name=hibernate.connection.usernameroot/property property name=hibernate.connection.passwordbooks/property property name=hbm2ddl.autoupdate/property property name=hibernate.show_sqltrue/property property name=hibernate.format_sqltrue/property property name=hibernate.transaction.factory_classorg.hibernate.transaction.JDBCTransactionFactory/property property name=hibernate.current_session_context_classthread/property /session-factory /hibernate-configuration Thanks, Angela
Unknown entity and SessionFactory null
All my entities are in myapp/entities package. By default, the package application-root-package.entities is scanned as described above. If you have additional packages containing entities, you must contribute them to the tapestry.hibernate.HibernateEntityPackageManager service configuration. Thanks, Angela
Re: Unknown entity and SessionFactory null
I already tried with that dependency, and it won't work for me. Thanks for the hmac-passphrase. Thanks, Angela
Re: Unknown entity and SessionFactory null
Hi Ken, The entities that I use are in the entities package. From Igor Drobiazko's book: ...by convention, the entities sub-package of the application's package is scanned for persistent classes. Any class annotated with @Entity, @Embeddable or @MappedSuperclass annotation is automatically added to the Hibernate configuration. Thanks, Angela
Re: Unknown entity and SessionFactory null
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_classcom.mysql.jdbc.Driver/property property name=hibernate.connection.urljdbc:mysql://localhost:3306/thibernatetest?autoReconnect=true/property property name=hibernate.dialectorg.hibernate.dialect.MySQLDialect/property property name=hibernate.connection.usernameroot/property property name=hibernate.connection.passwordadmin/property property name=hbm2ddl.autoupdate/property property name=hibernate.show_sqlfalse/property property name=hibernate.format_sqltrue/property property name=hibernate.connection.pool_size90/property property name=autoReconnecttrue/property property name=hibernate.c3p0.min_size5/property property name=hibernate.c3p0.max_size20/property property name=hibernate.c3p0.timeout300/property property name=hibernate.c3p0.max_statements50/property property name=hibernate.c3p0.idle_test_period3000/property property name=hibernate.connection.provider_classorg.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider/property property name=hibernate.connection.provider_classorg.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
Re: Unknown entity and SessionFactory null
!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_classcom.mysql.jdbc.Driver/property property name=hibernate.connection.urljdbc:mysql://localhost:3306/library/property property name=hibernate.dialectorg.hibernate.dialect.MySQLDialect/property property name=hibernate.connection.usernameroot/property property name=hibernate.connection.passwordbooks/property property name=hbm2ddl.autoupdate/property property name=hibernate.show_sqltrue/property property name=hibernate.format_sqltrue/property property name=hibernate.transaction.factory_classorg.hibernate.transaction.JDBCTransactionFactory/property property name=hibernate.current_session_context_classthread/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_classcom.mysql.jdbc.Driver/property property name=hibernate.connection.urljdbc:mysql://localhost:3306/thibernatetest?autoReconnect=true/property property name=hibernate.dialectorg.hibernate.dialect.MySQLDialect/property property name=hibernate.connection.usernameroot/property property name=hibernate.connection.passwordadmin/property property name=hbm2ddl.autoupdate/property property name=hibernate.show_sqlfalse/property property name=hibernate.format_sqltrue/property property name=hibernate.connection.pool_size90/property property name=autoReconnecttrue/property property name=hibernate.c3p0.min_size5/property property name=hibernate.c3p0.max_size20/property property name=hibernate.c3p0.timeout300/property property name=hibernate.c3p0.max_statements50/property property name=hibernate.c3p0.idle_test_period3000/property property name=hibernate.connection.provider_classorg.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider/property property name=hibernate.connection.provider_classorg.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
Re: Unknown entity and SessionFactory null
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_classcom.mysql.jdbc.Driver/property property name=hibernate.connection.urljdbc:mysql://localhost:3306/thibernatetest?autoReconnect=true/property property name=hibernate.dialectorg.hibernate.dialect.MySQLDialect/property property name=hibernate.connection.usernameroot/property property name=hibernate.connection.passwordadmin/property property name=hbm2ddl.autoupdate/property property name=hibernate.show_sqlfalse/property property name=hibernate.format_sqltrue/property property name=hibernate.connection.pool_size90/property property name=autoReconnecttrue/property property name=hibernate.c3p0.min_size5/property property name=hibernate.c3p0.max_size20/property property name=hibernate.c3p0.timeout300/property property name=hibernate.c3p0.max_statements50/property property name=hibernate.c3p0.idle_test_period3000/property property name=hibernate.connection.provider_classorg.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider/property property name=hibernate.connection.provider_classorg.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
Re: Unknown entity and SessionFactory null
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(ConfigurationString 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_classcom.mysql.jdbc.Driver/property property name=hibernate.connection.urljdbc:mysql://localhost:3306/library/property property name=hibernate.dialectorg.hibernate.dialect.MySQLDialect/property property name=hibernate.connection.usernameroot/property property name=hibernate.connection.passwordbooks/property property name=hbm2ddl.autoupdate/property property name=hibernate.show_sqltrue/property property name=hibernate.format_sqltrue/property property name=hibernate.transaction.factory_classorg.hibernate.transaction.JDBCTransactionFactory/property property name=hibernate.current_session_context_classthread/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_classcom.mysql.jdbc.Driver/property property name=hibernate.connection.urljdbc:mysql://localhost:3306/thibernatetest?autoReconnect=true/property property name=hibernate.dialectorg.hibernate.dialect.MySQLDialect/property property name=hibernate.connection.usernameroot/property property name=hibernate.connection.passwordadmin/property property name=hbm2ddl.autoupdate/property property name=hibernate.show_sqlfalse/property property name=hibernate.format_sqltrue/property property name=hibernate.connection.pool_size90/property property name=autoReconnecttrue/property property name=hibernate.c3p0.min_size5/property
Re: Unknown entity and SessionFactory null
Here's the link to console output http://justpaste.it/2n2r Thanks, Angela From: Boris Horvat horvat.z.bo...@gmail.com To: Andjela Djenic andjel...@yahoo.com Cc: Tapestry users users@tapestry.apache.org Sent: Thursday, May 16, 2013 10:29 PM Subject: Re: Unknown entity and SessionFactory null What exception? On Thu, May 16, 2013 at 10:01 PM, Andjela Djenic andjel...@yahoo.comwrote: 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(ConfigurationString 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.comwrote: !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_classcom.mysql.jdbc.Driver/property property name=hibernate.connection.urljdbc:mysql://localhost:3306/library/property property name=hibernate.dialectorg.hibernate.dialect.MySQLDialect/property property name=hibernate.connection.usernameroot/property property name=hibernate.connection.passwordbooks/property property name=hbm2ddl.autoupdate/property property name=hibernate.show_sqltrue/property property name=hibernate.format_sqltrue/property property name=hibernate.transaction.factory_classorg.hibernate.transaction.JDBCTransactionFactory/property property name=hibernate.current_session_context_classthread/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_classcom.mysql.jdbc.Driver/property property name=hibernate.connection.urljdbc:mysql://localhost:3306/thibernatetest?autoReconnect=true/property property name
Re: Unknown entity and SessionFactory null
It was wrong hibernate mapping. It works now without adding entities to hibernate.config.xml and without adding the contribution to HibernateEntityPackageManager class. I know that tapestry-hibernate covers tapestry-core and tapestry-hibernate-core, but for some reason my app won't work with that dependency. Thanks so much for the help! Angela
Re: Unknown entity and SessionFactory null
Hvala! :) From: Boris Horvat horvat.z.bo...@gmail.com To: Tapestry users users@tapestry.apache.org; Andjela Djenic andjel...@yahoo.com Sent: Friday, May 17, 2013 12:06 AM Subject: Re: Unknown entity and SessionFactory null Srecno u projektu... Zanimljivo da se tapestry radi sada na fon-u ja sam ga radio u 4toj On Fri, May 17, 2013 at 12:02 AM, Andjela Djenic andjel...@yahoo.comwrote: It was wrong hibernate mapping. It works now without adding entities to hibernate.config.xml and without adding the contribution to HibernateEntityPackageManager class. I know that tapestry-hibernate covers tapestry-core and tapestry-hibernate-core, but for some reason my app won't work with that dependency. Thanks so much for the help! Angela -- Sincerely *Boris Horvat*