Using hibernate on Tomcat 5.5
Hi; This is really a hibernate issue but as some people on this list may hit this problem due to the hibernate docs, I figured I should post here too. Tomcat 5.5 has changed how it does the JNDI settings for a JDBC setup. I am still working through some minor details making sure I have them exactly right. But the following works. First, do not place anything in server.xml. Everything you do will go in your webapp directory. My webapp is named store. Note: I do not create a war when developing so this is in an exploded directory. META-INF/context.xml(complete): Context path=/store docBase=store debug=5 reloadable=true crossContext=true Resource name=jdbc/storeDB auth=Container type=javax.sql.DataSource username=sa password=mmouse driverClassName=com.microsoft.jdbc.sqlserver.SQLServerDriver url=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=StoreTest;Select Method=cursor maxActive=8 maxIdle=4/ /Context web.xml (just the resource part): web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 ... resource-ref descriptionConnection to my DB./description res-ref-namejdbc/storeDB/res-ref-name res-typejavax.sql.DataSource /res-type res-authContainer/res-auth /resource-ref ... /web-app hibernate.cfg.xml (just DB part): session-factory property name=show_sqlfalse/property property name=dialectorg.hibernate.dialect.SQLServerDialect/property property name=connection.datasourcejava:/comp/env/jdbc/storeDB/property ... /session-factory /hibernate-configuration AND - this is important - this will not work when run from IntelliJ! It only works if you start Tomcat and use it normally. Running under IntelliJ Ok, here's the IntelliJ part you have to do. Lets assume your webapp is named store. 1) copy webapps/store/META-INF/context.xml to %Tomcat 5.5%\conf\Catalina\localhost/store.xml - note the filename change. 2) In the run/debug configuration, deployment tab, set the application context to /store (the default is /). 3) In the server tab the startup page is now http://localhost:8080/store/index.html (the store directory is added). And then - - it works!!! thanks - dave
RE: Using hibernate
We use straight JDBC and Hibernate on our intranet. JDBC is used for where speed is needed, like hitting the database for nav functions etc... but Hibernate for pure intranet based applications like holiday forms or purchase ordering, because it's nice to persist/unpersist complex application model objects without worrying about all the SQL hassle to do this, and speed is not an absolute, though saying this Hibernate does not visibly slow anything down at all, it's actually v. quick and easy. Initial learning curve but once you're in it's good stuff to use, and boasts being the most widely used ORM on any platform, so there's good support (part of Jboss now too I believe). That's my 2p. Allistair. -Original Message- From: Larry Meadors [mailto:[EMAIL PROTECTED] Sent: 14 March 2005 04:18 To: Tomcat Users List; [EMAIL PROTECTED] Subject: Re: Using hibernate I have used straight JDBC, Hibernate, and iBATIS. For me, the sweet spot is iBATIS. It provides very near the performance of JDBC, without the complexity. IMO, I will use ORM when database vendors support it directly, not when I have to wrap my database in a ORM layer. Larry On Sun, 13 Mar 2005 20:00:08 +0200, haim [EMAIL PROTECTED] wrote: We are planing to use object/relational persistence and query service like hibernate or Castor JDO. Does anyone have any recomaidations for the above? Does anyone has good/bad experience using similar technologies? Thanks Haim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE --- QAS Ltd. Developers of QuickAddress Software a href=http://www.qas.com;www.qas.com/a Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- /FONT - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using hibernate
We are planing to use object/relational persistence and query service like hibernate or Castor JDO. Does anyone have any recomaidations for the above? Does anyone has good/bad experience using similar technologies? Thanks Haim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using hibernate
On Mar 13, 2005, at 19:00, haim wrote: We are planing to use object/relational persistence and query service like hibernate or Castor JDO. Does anyone have any recomaidations for the above? Take a serious look at Cayenne: http://www.objectstyle.org/cayenne/ Much nicer than Hibernate in my opinion. Cayenne is the open source sibling of NeXT's Enterprise Object Framework: http://c2.com/cgi/wiki?EnterpriseObjectsFramework Which is still somewhat available from Apple: http://developer.apple.com/documentation/WebObjects/Enterprise_Objects/ index.html Does anyone has good/bad experience using similar technologies? Yes. Both. Most of the time those O/R mapping tools are overkill. YMMV. Have you considered _not_ using a SQL database in the first place? Cheers -- PA, Onnay Equitursay http://alt.textdrive.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using hibernate
I have used straight JDBC, Hibernate, and iBATIS. For me, the sweet spot is iBATIS. It provides very near the performance of JDBC, without the complexity. IMO, I will use ORM when database vendors support it directly, not when I have to wrap my database in a ORM layer. Larry On Sun, 13 Mar 2005 20:00:08 +0200, haim [EMAIL PROTECTED] wrote: We are planing to use object/relational persistence and query service like hibernate or Castor JDO. Does anyone have any recomaidations for the above? Does anyone has good/bad experience using similar technologies? Thanks Haim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]