You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Martin Stolz <ms...@mstsoft.com> on 2004/05/05 11:41:21 UTC

Hibernate + Turbine TDK + My own Screen: This was a tough one...

Hi there,

this is my first posting to the list, but certainly not the last ;-)

I am relatively new to Turbine and have spent the whole day yesterday tracing down this problem... I want to use Hibernate with Turbine (TDK 2.3). I have set everything up like told in the Hibernate HOW-TO, except i changed the code a bit to not require the PersistenceManager class (since i just want to get one successful dataset right now!). I also dont use lazy initialisation (for now) so i won´t need the Servlet filter (later, of course, i will need it...)

What happens is:

1) When i load my Screen which is a clone of the Notes application, it opens up just fine. If i set sth in the context, i can access it in the template. So basic setup works.

2) When i comment in my Hibernate Configuration stuff, Turbine does not log any error or sth, but the Screen class (which worked 10 Seconds ago) is not found, instead, it is searching for all possible classes until it renders my Screen with pure Velocity. Look at this excerpt:

[DEBUG] JavaScreenFactory - -Class Fragment is notes.Index
[DEBUG] JavaScreenFactory - -Trying de.pentasys.puma.modules.screens.notes.Index
I AM HERE!!!
[INFO] Index - -I WORK TOO!
[INFO] Index - -loading hibernate...  ----- This is inside the Constructor of my Screen!!!!
[INFO] Environment - -Hibernate 2.1 rc1
[INFO] Environment - -hibernate.properties not found
[INFO] Environment - -using CGLIB reflection optimizer
[INFO] Configuration - -Mapping resource: de/pentasys/puma/hibernate/Campaign.hbm.xml
[DEBUG] DTDEntityResolver - -trying to locate http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath under net/sf/hibernate/
[DEBUG] DTDEntityResolver - -found http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath
[INFO] Binder - -Mapping class: de.pentasys.puma.hibernate.Campaign -> CAMPAIGN
[DEBUG] Binder - -Mapped property: campaignId -> CAMPAIGN_ID, type: integer
[DEBUG] Binder - -Mapped property: campaignCd -> CAMPAIGN_CD, type: string
[DEBUG] Binder - -Mapped property: campaignTypeId -> CAMPAIGN_TYPE_ID, type: string
[DEBUG] Binder - -Mapped property: subjectGerTx -> SUBJECT_GER_TX, type: string
[DEBUG] Binder - -Mapped property: shortGerTx -> SHORT_GER_TX, type: string
[DEBUG] Binder - -Mapped property: subjectEngTx -> SUBJECT_ENG_TX, type: string
[DEBUG] Binder - -Mapped property: shortEngTx -> SHORT_ENG_TX, type: string
[DEBUG] Binder - -Mapped property: campaignCommentTx -> CAMPAIGN_COMMENT_TX, type: string
[DEBUG] Binder - -Mapped property: costLocation -> COST_LOCATION, type: string
[DEBUG] Binder - -Mapped property: originDt -> ORIGIN_DT, type: integer
[DEBUG] Binder - -Mapped property: originUserCd -> ORIGIN_USER_CD, type: string
[DEBUG] Binder - -Mapped property: modDt -> MOD_DT, type: integer
[DEBUG] Binder - -Mapped property: modUserCd -> MOD_USER_CD, type: string
[DEBUG] Binder - -Mapped property: camoisdeb -> CAMOISDEB, type: timestamp
[DEBUG] Binder - -Mapped property: camoisfin -> CAMOISFIN, type: timestamp
[DEBUG] Binder - -Mapped property: capncode -> CAPNCODE, type: string
[DEBUG] Binder - -Mapped property: caetat -> CAETAT, type: string
[DEBUG] Binder - -Mapped property: pplType -> PPL_TYPE, type: string
[DEBUG] Binder - -Mapped property: pplGiftTx -> PPL_GIFT_TX, type: string
[DEBUG] Binder - -Mapped property: adbId -> ADB_ID, type: integer
[DEBUG] Binder - -Mapped property: countryId -> COUNTRY_ID, type: string
[DEBUG] JavaScreenFactory - -de.pentasys.puma.modules.screens.notes.Index: No Class Definition found
[DEBUG] JavaScreenFactory - -Trying org.apache.turbine.flux.modules.screens.notes.Index
[DEBUG] JavaScreenFactory - -org.apache.turbine.flux.modules.screens.notes.Index: Not found
[DEBUG] JavaScreenFactory - -Trying org.apache.turbine.modules.screens.notes.Index
[DEBUG] JavaScreenFactory - -org.apache.turbine.modules.screens.notes.Index: Not found
[DEBUG] JavaScreenFactory - -Returning: null
[DEBUG] ClassMapper - -classPackage is now: notes
[DEBUG] ClassMapper - -Looking for notes.Default
[DEBUG] ScreenLoader - -Loading Screen notes.Default from the Assembler Broker
[DEBUG] JavaScreenFactory - -Class Fragment is notes.Default
[DEBUG] JavaScreenFactory - -Trying de.pentasys.puma.modules.screens.notes.Default
[DEBUG] JavaScreenFactory - -de.pentasys.puma.modules.screens.notes.Default: Not found
[DEBUG] JavaScreenFactory - -Trying org.apache.turbine.flux.modules.screens.notes.Default
[DEBUG] JavaScreenFactory - -org.apache.turbine.flux.modules.screens.notes.Default: Not found
[DEBUG] JavaScreenFactory - -Trying org.apache.turbine.modules.screens.notes.Default
...

What i find particularly strange is, that there is absolutely NO exception, error or sth. else. I don´t swallow exceptions, eighter. I really don´t know where they are gone.

Now, i have tried a lot of stuff. A real lot. I was not able to make it work, until i tried to access Hibernate from within a simple main program, where it started complaining about missing classes that i didn´t have. I could not figure out, why i didn´t get those exceptions from the TDK. After following the information in (http://www.hibernate.org/hib_docs/reference/en/html/quickstart.html) i could access hibernate from my Turbine app.

This is meant as additional information for using hibernate with Turbine. It is not clear to newbies following the very short and not so complete HOW-TO. Eventually i will write a HOW-TO that is complete and provide a functional base implementation. 

Another thing is, my Application was constantly ignoreing my Log4j.properties configuration, until i removed the Torque-generator-Jar from my classpath, since it somehow includes a log4j.properties that appeared in the classpath before my configuration. It is very greedy in logging everything with DEBUG, so a simple Query returning 500 Objects with hibernate took 3 Minutes to print all of its output. I do think that it is a bad idea to provide a jar file containing a logger configuration...

So far for my very first posting to a mailing list ;-)

Have a nice day,
martin

RE: Hibernate + Turbine TDK + My own Screen: This was a tough one...

Posted by Eric Pugh <ep...@upstate.com>.
Hi,

Thanks for the post..  Yeah, I wrote the original HOWTO, but I know it is
very rough.  Some edits would be fantastic!  Send them in and I'll make sure
to apply them.

Eric

> -----Original Message-----
> From: Martin Stolz [mailto:mst@mstsoft.com]
> Sent: Wednesday, May 05, 2004 10:41 AM
> To: turbine-user@jakarta.apache.org
> Subject: Hibernate + Turbine TDK + My own Screen: This was a tough
> one...
>
>
> Hi there,
>
> this is my first posting to the list, but certainly not the last ;-)
>
> I am relatively new to Turbine and have spent the whole day yesterday
> tracing down this problem... I want to use Hibernate with Turbine (TDK
> 2.3). I have set everything up like told in the Hibernate HOW-TO, except
> i changed the code a bit to not require the PersistenceManager class
> (since i just want to get one successful dataset right now!). I also
> dont use lazy initialisation (for now) so i won´t need the Servlet
> filter (later, of course, i will need it...)
>
> What happens is:
>
> 1) When i load my Screen which is a clone of the Notes application, it
> opens up just fine. If i set sth in the context, i can access it in the
> template. So basic setup works.
>
> 2) When i comment in my Hibernate Configuration stuff, Turbine does not
> log any error or sth, but the Screen class (which worked 10 Seconds ago)
> is not found, instead, it is searching for all possible classes until it
> renders my Screen with pure Velocity. Look at this excerpt:
>
> [DEBUG] JavaScreenFactory - -Class Fragment is notes.Index
> [DEBUG] JavaScreenFactory - -Trying
> de.pentasys.puma.modules.screens.notes.Index
> I AM HERE!!!
> [INFO] Index - -I WORK TOO!
> [INFO] Index - -loading hibernate...  ----- This is inside the
> Constructor of my Screen!!!!
> [INFO] Environment - -Hibernate 2.1 rc1
> [INFO] Environment - -hibernate.properties not found
> [INFO] Environment - -using CGLIB reflection optimizer
> [INFO] Configuration - -Mapping resource:
> de/pentasys/puma/hibernate/Campaign.hbm.xml
> [DEBUG] DTDEntityResolver - -trying to locate
> http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath
> under net/sf/hibernate/
> [DEBUG] DTDEntityResolver - -found
> http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath
> [INFO] Binder - -Mapping class: de.pentasys.puma.hibernate.Campaign ->
> CAMPAIGN
> [DEBUG] Binder - -Mapped property: campaignId -> CAMPAIGN_ID, type:
> integer
> [DEBUG] Binder - -Mapped property: campaignCd -> CAMPAIGN_CD, type:
> string
> [DEBUG] Binder - -Mapped property: campaignTypeId -> CAMPAIGN_TYPE_ID,
> type: string
> [DEBUG] Binder - -Mapped property: subjectGerTx -> SUBJECT_GER_TX, type:
> string
> [DEBUG] Binder - -Mapped property: shortGerTx -> SHORT_GER_TX, type:
> string
> [DEBUG] Binder - -Mapped property: subjectEngTx -> SUBJECT_ENG_TX, type:
> string
> [DEBUG] Binder - -Mapped property: shortEngTx -> SHORT_ENG_TX, type:
> string
> [DEBUG] Binder - -Mapped property: campaignCommentTx ->
> CAMPAIGN_COMMENT_TX, type: string
> [DEBUG] Binder - -Mapped property: costLocation -> COST_LOCATION, type:
> string
> [DEBUG] Binder - -Mapped property: originDt -> ORIGIN_DT, type: integer
> [DEBUG] Binder - -Mapped property: originUserCd -> ORIGIN_USER_CD, type:
> string
> [DEBUG] Binder - -Mapped property: modDt -> MOD_DT, type: integer
> [DEBUG] Binder - -Mapped property: modUserCd -> MOD_USER_CD, type:
> string
> [DEBUG] Binder - -Mapped property: camoisdeb -> CAMOISDEB, type:
> timestamp
> [DEBUG] Binder - -Mapped property: camoisfin -> CAMOISFIN, type:
> timestamp
> [DEBUG] Binder - -Mapped property: capncode -> CAPNCODE, type: string
> [DEBUG] Binder - -Mapped property: caetat -> CAETAT, type: string
> [DEBUG] Binder - -Mapped property: pplType -> PPL_TYPE, type: string
> [DEBUG] Binder - -Mapped property: pplGiftTx -> PPL_GIFT_TX, type:
> string
> [DEBUG] Binder - -Mapped property: adbId -> ADB_ID, type: integer
> [DEBUG] Binder - -Mapped property: countryId -> COUNTRY_ID, type: string
> [DEBUG] JavaScreenFactory -
> -de.pentasys.puma.modules.screens.notes.Index: No Class Definition found
> [DEBUG] JavaScreenFactory - -Trying
> org.apache.turbine.flux.modules.screens.notes.Index
> [DEBUG] JavaScreenFactory -
> -org.apache.turbine.flux.modules.screens.notes.Index: Not found
> [DEBUG] JavaScreenFactory - -Trying
> org.apache.turbine.modules.screens.notes.Index
> [DEBUG] JavaScreenFactory -
> -org.apache.turbine.modules.screens.notes.Index: Not found
> [DEBUG] JavaScreenFactory - -Returning: null
> [DEBUG] ClassMapper - -classPackage is now: notes
> [DEBUG] ClassMapper - -Looking for notes.Default
> [DEBUG] ScreenLoader - -Loading Screen notes.Default from the Assembler
> Broker
> [DEBUG] JavaScreenFactory - -Class Fragment is notes.Default
> [DEBUG] JavaScreenFactory - -Trying
> de.pentasys.puma.modules.screens.notes.Default
> [DEBUG] JavaScreenFactory -
> -de.pentasys.puma.modules.screens.notes.Default: Not found
> [DEBUG] JavaScreenFactory - -Trying
> org.apache.turbine.flux.modules.screens.notes.Default
> [DEBUG] JavaScreenFactory -
> -org.apache.turbine.flux.modules.screens.notes.Default: Not found
> [DEBUG] JavaScreenFactory - -Trying
> org.apache.turbine.modules.screens.notes.Default
> ...
>
> What i find particularly strange is, that there is absolutely NO
> exception, error or sth. else. I don´t swallow exceptions, eighter. I
> really don´t know where they are gone.
>
> Now, i have tried a lot of stuff. A real lot. I was not able to make it
> work, until i tried to access Hibernate from within a simple main
> program, where it started complaining about missing classes that i
> didn´t have. I could not figure out, why i didn´t get those exceptions
> from the TDK. After following the information in
> (http://www.hibernate.org/hib_docs/reference/en/html/quickstart.html) i
> could access hibernate from my Turbine app.
>
> This is meant as additional information for using hibernate with
> Turbine. It is not clear to newbies following the very short and not so
> complete HOW-TO. Eventually i will write a HOW-TO that is complete and
> provide a functional base implementation.
>
> Another thing is, my Application was constantly ignoreing my
> Log4j.properties configuration, until i removed the Torque-generator-Jar
> from my classpath, since it somehow includes a log4j.properties that
> appeared in the classpath before my configuration. It is very greedy in
> logging everything with DEBUG, so a simple Query returning 500 Objects
> with hibernate took 3 Minutes to print all of its output. I do think
> that it is a bad idea to provide a jar file containing a logger
> configuration...
>
> So far for my very first posting to a mailing list ;-)
>
> Have a nice day,
> martin
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org