Discussion:
T5 howto tapestry-hibernate
Sebastian Heyden
2007-07-10 23:50:26 UTC
Permalink
hello folks,


since some days i write my first application with tapestry and now i want
to get tapestry-hibernate working. i really tried hard to find help in the
mailing-list
archiv and by googling. thats what i got so far:

- a package called entities
- Annotations on my Entity
- hibernate, jta and hibernate-annotations in my classpath
- hibernate.cfg.xml with connection details without mapping-files

i simply tried

@Inject Session session

in a Hivemind Service but the session was null when i wanted to use it.
do i have to register hibernate somehow in AppModule?


thanks in advance,
sebas
小司
2007-07-11 00:38:22 UTC
Permalink
You can see this

http://linuxboy.javaeye.com/blog/68311
I learn from there . it works well.
Post by Sebastian Heyden
hello folks,
since some days i write my first application with tapestry and now i want
to get tapestry-hibernate working. i really tried hard to find help in the
mailing-list
- a package called entities
- Annotations on my Entity
- hibernate, jta and hibernate-annotations in my classpath
- hibernate.cfg.xml with connection details without mapping-files
i simply tried
@Inject Session session
in a Hivemind Service but the session was null when i wanted to use it.
do i have to register hibernate somehow in AppModule?
thanks in advance,
sebas
--
Sebastian Heyden
2007-07-11 08:36:59 UTC
Permalink
that helped me a lot further!

but now i have the problem that the entities are not found. aren't they
automaticly picked up by
tapestry-hibernate?

this is my debug output:



[INFO] Started Jetty Server

[DEBUG] HibernateSessionManager Creating service 'HibernateSessionManager'.

[DEBUG] Session Invoking method
org.apache.tapestry.hibernate.HibernateModule.build(HibernateSessionManager,
PropertyShadowBuilder) (at HibernateModule.java:84).

[DEBUG] HibernateSessionSource Creating service 'HibernateSessionSource'.

[DEBUG] HibernateSessionManager Invoking method
org.apache.tapestry.hibernate.HibernateModule.build(HibernateSessionSource,
ThreadCleanupHub) (at HibernateModule.java:62).

[DEBUG] HibernateSessionSource Invoking method
org.apache.tapestry.hibernate.HibernateModule.contributeHibernateSessionSource(Configuration,
String) (at HibernateModule.java:51).

[DEBUG] HibernateSessionSource Constructed configuration: [
org.czarlylab.javashop.entities]

[DEBUG] HibernateSessionSource Invoking constructor
org.apache.tapestry.internal.hibernate.HibernateSessionSourceImpl(Log,
Collection, ClassNameLocator) (at HibernateSessionSourceImpl.java:35).

[WARN] AnnotationBinder Package not found or wo package-info.java:
org.czarlylab.javashop.entities

[WARN] ConfigurationFactory No configuration found. Configuring ehcache from
ehcache-failsafe.xml found in the classpath:
jar:file:/C:/Users/basti/.m2/repository/net/sf/ehcache/ehcache/1.2.3/ehcache-
1.2.3.jar!/ehcache-failsafe.xml

[WARN] JDBCExceptionReporter SQL Warning: 10000, SQLState: 01J01

[WARN] JDBCExceptionReporter Database 'JAVASHOP' not created, connection
made to existing database instead.

[WARN] EhCacheProvider Could not find configuration [
org.hibernate.cache.UpdateTimestampsCache]; using defaults.

[WARN] EhCacheProvider Could not find configuration [
org.hibernate.cache.StandardQueryCache]; using defaults.

[INFO] HibernateSessionSource Hibernate startup: 639 ms to configure,
5.196ms overall.
Post by 小司
You can see this
http://linuxboy.javaeye.com/blog/68311
I learn from there . it works well.
Post by Sebastian Heyden
hello folks,
since some days i write my first application with tapestry and now i
want
Post by Sebastian Heyden
to get tapestry-hibernate working. i really tried hard to find help in
the
Post by Sebastian Heyden
mailing-list
- a package called entities
- Annotations on my Entity
- hibernate, jta and hibernate-annotations in my classpath
- hibernate.cfg.xml with connection details without mapping-files
i simply tried
@Inject Session session
in a Hivemind Service but the session was null when i wanted to use it.
do i have to register hibernate somehow in AppModule?
thanks in advance,
sebas
--
µÃÓëʧ¶ŒÊÇÉú»î
Sebastian Heyden
2007-07-11 08:42:48 UTC
Permalink
additionaly i want to give you my hibernate.cfg.xml and the following
exception



<hibernate-configuration>

<session-factory>

<property name="configurationClass">
org.hibernate.cfg.AnnotationConfiguration</property>

<property name="connection.driver_class">
org.apache.derby.jdbc.EmbeddedDriver</property>

<property name="hibernate.connection.url">jdbc:derby:JAVASHOP;create=true
</property>

<property name="hibernate.connection.username">APP</property>

<property name="hibernate.connection.password"></property>

<property name="hibernate.connection.pool_size">10</property>

<property name="show_sql">true</property>

<property name="dialect">org.hibernate.dialect.DerbyDialect</property>

<property name="hibernate.hbm2ddl.auto">create</property>

<!-- Cache Configurations -->

<!-- Using net.sf.ehcache.hibernate.SingletonEhCacheProvider instead of

net.sf.ehcache.hibernate.EhCacheProvider ensures the same instance

of CacheManager is referred to by both Hibernate and our JMX Agent

simpleJpaHibernateApp.agents.jmxAgent. (Thanks to Greg Luck!) -->

<property name="hibernate.cache.use_minimal_puts">false</property>

<property name="hibernate.cache.use_query_cache">true</property>

<property name="hibernate.cache.use_second_level_cache">true</property>

<property name="hibernate.cache.use_structured_entries">true</property>

<property name="hibernate.cache.provider_class">
org.hibernate.cache.EhCacheProvider</property>

<property name="hibernate.generate_statistics">false</property>

<property name="hibernate.cache.use_structured_entries">false</property>

</session-factory>

</hibernate-configuration>


-------------------------------------------------------------------


[INFO] HibernateSessionSource Hibernate startup: 646 ms to configure,
4.904ms overall.

[INFO] HibernateSessionSource Configured Hibernate entities:

[ERROR] BrowseCatalog Render queue error in SetupRender[BrowseCatalog:
categorylist.loop]: Failure reading parameter source of component
BrowseCatalog:categorylist.loop: Unknown entity:
org.czarlylab.javashop.entities.Category
Post by Sebastian Heyden
that helped me a lot further!
but now i have the problem that the entities are not found. aren't they
automaticly picked up by
tapestry-hibernate?
[INFO] Started Jetty Server
[DEBUG] HibernateSessionManager Creating service
'HibernateSessionManager'.
[DEBUG] Session Invoking method
org.apache.tapestry.hibernate.HibernateModule.build(HibernateSessionManager,
PropertyShadowBuilder) (at HibernateModule.java:84).
[DEBUG] HibernateSessionSource Creating service 'HibernateSessionSource'.
[DEBUG] HibernateSessionManager Invoking method
org.apache.tapestry.hibernate.HibernateModule.build(HibernateSessionSource,
ThreadCleanupHub) (at HibernateModule.java:62).
[DEBUG] HibernateSessionSource Invoking method
org.apache.tapestry.hibernate.HibernateModule.contributeHibernateSessionSource(Configuration,
String) (at HibernateModule.java:51).
[DEBUG] HibernateSessionSource Constructed configuration: [
org.czarlylab.javashop.entities]
[DEBUG] HibernateSessionSource Invoking constructor
org.apache.tapestry.internal.hibernate.HibernateSessionSourceImpl(Log,
Collection, ClassNameLocator) (at HibernateSessionSourceImpl.java:35).
org.czarlylab.javashop.entities
[WARN] ConfigurationFactory No configuration found. Configuring ehcache
jar:file:/C:/Users/basti/.m2/repository/net/sf/ehcache/ehcache/1.2.3/ehcache-
1.2.3.jar!/ehcache-failsafe.xml
[WARN] JDBCExceptionReporter SQL Warning: 10000, SQLState: 01J01
[WARN] JDBCExceptionReporter Database 'JAVASHOP' not created, connection
made to existing database instead.
[WARN] EhCacheProvider Could not find configuration [
org.hibernate.cache.UpdateTimestampsCache]; using defaults.
[WARN] EhCacheProvider Could not find configuration [
org.hibernate.cache.StandardQueryCache]; using defaults.
[INFO] HibernateSessionSource Hibernate startup: 639 ms to configure,
5.196 ms overall.
Post by 小司
You can see this
http://linuxboy.javaeye.com/blog/68311
I learn from there . it works well.
Post by Sebastian Heyden
hello folks,
since some days i write my first application with tapestry and now i
want
Post by Sebastian Heyden
to get tapestry-hibernate working. i really tried hard to find help in
the
Post by Sebastian Heyden
mailing-list
- a package called entities
- Annotations on my Entity
- hibernate, jta and hibernate-annotations in my classpath
- hibernate.cfg.xml with connection details without mapping-files
i simply tried
@Inject Session session
in a Hivemind Service but the session was null when i wanted to use
it.
Post by Sebastian Heyden
do i have to register hibernate somehow in AppModule?
thanks in advance,
sebas
--
µÃÓëʧ¶ŒÊÇÉú»î
Davor Hrg
2007-07-11 09:37:47 UTC
Permalink
tapestry hibernate will pick it up if you follow the structure .....
myapp.entities
myapp.pages
myapp.components ......

take a look at the error
[WARN] AnnotationBinder Package not found or wo package-info.java:
org.czarlylab.javashop.entities

are you sure you have correct value in web.xml:
<param-name>tapestry.app-package</param-name>
<param-value>org.czarlylab.javashop</param-value>


Davor Hrg
Post by Sebastian Heyden
additionaly i want to give you my hibernate.cfg.xml and the following
exception
<hibernate-configuration>
<session-factory>
<property name="configurationClass">
org.hibernate.cfg.AnnotationConfiguration</property>
<property name="connection.driver_class">
org.apache.derby.jdbc.EmbeddedDriver</property>
<property name="hibernate.connection.url">jdbc:derby:JAVASHOP;create=true
</property>
<property name="hibernate.connection.username">APP</property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.DerbyDialect</property>
<property name="hibernate.hbm2ddl.auto">create</property>
<!-- Cache Configurations -->
<!-- Using net.sf.ehcache.hibernate.SingletonEhCacheProvider instead of
net.sf.ehcache.hibernate.EhCacheProvider ensures the same instance
of CacheManager is referred to by both Hibernate and our JMX Agent
simpleJpaHibernateApp.agents.jmxAgent. (Thanks to Greg Luck!) -->
<property name="hibernate.cache.use_minimal_puts">false</property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.use_structured_entries">true</property>
<property name="hibernate.cache.provider_class">
org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.generate_statistics">false</property>
<property name="hibernate.cache.use_structured_entries">false</property>
</session-factory>
</hibernate-configuration>
-------------------------------------------------------------------
[INFO] HibernateSessionSource Hibernate startup: 646 ms to configure,
4.904ms overall.
categorylist.loop]: Failure reading parameter source of component
org.czarlylab.javashop.entities.Category
Post by Sebastian Heyden
that helped me a lot further!
but now i have the problem that the entities are not found. aren't they
automaticly picked up by
tapestry-hibernate?
[INFO] Started Jetty Server
[DEBUG] HibernateSessionManager Creating service
'HibernateSessionManager'.
[DEBUG] Session Invoking method
org.apache.tapestry.hibernate.HibernateModule.build
(HibernateSessionManager,
Post by Sebastian Heyden
PropertyShadowBuilder) (at HibernateModule.java:84).
[DEBUG] HibernateSessionSource Creating service
'HibernateSessionSource'.
Post by Sebastian Heyden
[DEBUG] HibernateSessionManager Invoking method
org.apache.tapestry.hibernate.HibernateModule.build
(HibernateSessionSource,
Post by Sebastian Heyden
ThreadCleanupHub) (at HibernateModule.java:62).
[DEBUG] HibernateSessionSource Invoking method
org.apache.tapestry.hibernate.HibernateModule.contributeHibernateSessionSource
(Configuration,
Post by Sebastian Heyden
String) (at HibernateModule.java:51).
[DEBUG] HibernateSessionSource Constructed configuration: [
org.czarlylab.javashop.entities]
[DEBUG] HibernateSessionSource Invoking constructor
org.apache.tapestry.internal.hibernate.HibernateSessionSourceImpl(Log,
Collection, ClassNameLocator) (at HibernateSessionSourceImpl.java:35).
org.czarlylab.javashop.entities
[WARN] ConfigurationFactory No configuration found. Configuring ehcache
jar:file:/C:/Users/basti/.m2/repository/net/sf/ehcache/ehcache/1.2.3/ehcache-
Post by Sebastian Heyden
1.2.3.jar!/ehcache-failsafe.xml
[WARN] JDBCExceptionReporter SQL Warning: 10000, SQLState: 01J01
[WARN] JDBCExceptionReporter Database 'JAVASHOP' not created, connection
made to existing database instead.
[WARN] EhCacheProvider Could not find configuration [
org.hibernate.cache.UpdateTimestampsCache]; using defaults.
[WARN] EhCacheProvider Could not find configuration [
org.hibernate.cache.StandardQueryCache]; using defaults.
[INFO] HibernateSessionSource Hibernate startup: 639 ms to configure,
5.196 ms overall.
Post by 小司
You can see this
http://linuxboy.javaeye.com/blog/68311
I learn from there . it works well.
Post by Sebastian Heyden
hello folks,
since some days i write my first application with tapestry and now i
want
Post by Sebastian Heyden
to get tapestry-hibernate working. i really tried hard to find help
in
Post by Sebastian Heyden
Post by 小司
the
Post by Sebastian Heyden
mailing-list
- a package called entities
- Annotations on my Entity
- hibernate, jta and hibernate-annotations in my classpath
- hibernate.cfg.xml with connection details without mapping-files
i simply tried
@Inject Session session
in a Hivemind Service but the session was null when i wanted to use
it.
Post by Sebastian Heyden
do i have to register hibernate somehow in AppModule?
thanks in advance,
sebas
--
µÃÓëʧ¶ŒÊÇÉú»î
Sebastian Heyden
2007-07-11 10:06:20 UTC
Permalink
hi,


yes i got this configuration in my web.xml and everything except hibernate
works for me
so far.

i also added the code

public static CatalogDao buildCtalaogDao(
@InjectService("Session")
Session session) {
return new CatalogDaoImpl(session);
}

to my AppModule.java with no results. the debug output remains exactly the
same.

the only thing that makes a difference is when i place a
package-info.javafile in the
entities folder. but i dont know what this is and what its good for. at
least it changes
its output to:

[DEBUG] HibernateSessionSource Constructed configuration: [
org.czarlylab.javashop.entities]
even if package-info.java file is totally empty.
but it doesnt find the entities. its the same with T5.0.5 and T5.0.4
Post by Davor Hrg
tapestry hibernate will pick it up if you follow the structure .....
myapp.entities
myapp.pages
myapp.components ......
take a look at the error
org.czarlylab.javashop.entities
<param-name>tapestry.app-package</param-name>
<param-value>org.czarlylab.javashop</param-value>
Davor Hrg
Post by Sebastian Heyden
additionaly i want to give you my hibernate.cfg.xml and the following
exception
<hibernate-configuration>
<session-factory>
<property name="configurationClass">
org.hibernate.cfg.AnnotationConfiguration</property>
<property name="connection.driver_class">
org.apache.derby.jdbc.EmbeddedDriver</property>
<property name="hibernate.connection.url">jdbc:derby:JAVASHOP;create=true
</property>
<property name="hibernate.connection.username">APP</property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.DerbyDialect </property>
<property name="hibernate.hbm2ddl.auto">create</property>
<!-- Cache Configurations -->
<!-- Using net.sf.ehcache.hibernate.SingletonEhCacheProvider instead of
net.sf.ehcache.hibernate.EhCacheProvider ensures the same instance
of CacheManager is referred to by both Hibernate and our JMX Agent
simpleJpaHibernateApp.agents.jmxAgent. (Thanks to Greg Luck!) -->
<property name="hibernate.cache.use_minimal_puts">false</property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name=" hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.use_structured_entries">true</property>
<property name="hibernate.cache.provider_class ">
org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.generate_statistics">false</property>
<property name="hibernate.cache.use_structured_entries">false</property>
</session-factory>
</hibernate-configuration>
-------------------------------------------------------------------
[INFO] HibernateSessionSource Hibernate startup: 646 ms to configure,
4.904ms overall.
categorylist.loop]: Failure reading parameter source of component
org.czarlylab.javashop.entities.Category
Post by Sebastian Heyden
that helped me a lot further!
but now i have the problem that the entities are not found. aren't
they
Post by Sebastian Heyden
automaticly picked up by
tapestry-hibernate?
[INFO] Started Jetty Server
[DEBUG] HibernateSessionManager Creating service
'HibernateSessionManager'.
[DEBUG] Session Invoking method
org.apache.tapestry.hibernate.HibernateModule.build
(HibernateSessionManager,
Post by Sebastian Heyden
PropertyShadowBuilder) (at HibernateModule.java:84).
[DEBUG] HibernateSessionSource Creating service
'HibernateSessionSource'.
Post by Sebastian Heyden
[DEBUG] HibernateSessionManager Invoking method
org.apache.tapestry.hibernate.HibernateModule.build
(HibernateSessionSource,
Post by Sebastian Heyden
ThreadCleanupHub) (at HibernateModule.java:62).
[DEBUG] HibernateSessionSource Invoking method
org.apache.tapestry.hibernate.HibernateModule.contributeHibernateSessionSource
(Configuration,
Post by Sebastian Heyden
String) (at HibernateModule.java:51).
[DEBUG] HibernateSessionSource Constructed configuration: [
org.czarlylab.javashop.entities]
[DEBUG] HibernateSessionSource Invoking constructor
org.apache.tapestry.internal.hibernate.HibernateSessionSourceImpl(Log,
Collection, ClassNameLocator) (at HibernateSessionSourceImpl.java:35).
org.czarlylab.javashop.entities
[WARN] ConfigurationFactory No configuration found. Configuring
ehcache
jar:file:/C:/Users/basti/.m2/repository/net/sf/ehcache/ehcache/1.2.3/ehcache-
Post by Sebastian Heyden
1.2.3.jar!/ehcache-failsafe.xml
[WARN] JDBCExceptionReporter SQL Warning: 10000, SQLState: 01J01
[WARN] JDBCExceptionReporter Database 'JAVASHOP' not created,
connection
Post by Sebastian Heyden
made to existing database instead.
[WARN] EhCacheProvider Could not find configuration [
org.hibernate.cache.UpdateTimestampsCache ]; using defaults.
[WARN] EhCacheProvider Could not find configuration [
org.hibernate.cache.StandardQueryCache]; using defaults.
[INFO] HibernateSessionSource Hibernate startup: 639 ms to configure,
5.196 ms overall.
Post by 小司
You can see this
http://linuxboy.javaeye.com/blog/68311
I learn from there . it works well.
Post by Sebastian Heyden
hello folks,
since some days i write my first application with tapestry and now
i
Post by Sebastian Heyden
Post by 小司
want
Post by Sebastian Heyden
to get tapestry-hibernate working. i really tried hard to find
help in
Post by Sebastian Heyden
Post by 小司
the
Post by Sebastian Heyden
mailing-list
- a package called entities
- Annotations on my Entity
- hibernate, jta and hibernate-annotations in my classpath
- hibernate.cfg.xml with connection details without mapping-files
i simply tried
@Inject Session session
in a Hivemind Service but the session was null when i wanted to
use
Post by Sebastian Heyden
Post by 小司
it.
Post by Sebastian Heyden
do i have to register hibernate somehow in AppModule?
thanks in advance,
sebas
--
µÃÓëʧ¶ŒÊÇÉú»î
Loading...