Hibernate FAQ
-------------
* Hibernate expects my JDBC driver to support JDBC2 but it doesn't!

Set hibernate.use_jdbc2=false or upgrade your driver to the latest version.
Hibernate chooses a sensible default value for hibernate.use_jdbc2, based
upon your SQL dialect.


* I saved/deleted/updated an object/collection but I can't see the changes
in the database!

You must either call Transaction.commit() (If using the transaction API) or
Session.flush() at the end of a session to flush your changes to the
database.


* I saved a parent object and its associated objects weren't saved to the
database

Associated objects must be saved explicitly (by calling Session.save()) or
the association must be mapped with cascade="all".


* How can I count the number of query results without actually returning
them?

  ( (Integer) session.iterate("select count(*) from ....").next()
).intValue()


* How do I specify the length of a column for the SchemExport tool? A
unique column? A not-null column?

Column lengths and constraints may be specified in the mapping document. If
you browse

  http://hibernate.sourceforge.net/hibernate-mapping.dtd

you will find it quite well documented.


* How can I use quoted SQL identifiers?

You can't. Sorry. We will fix this at some stage....


* I'm seeing ClassCastExceptions when I try to call Hibernate from inside
JUnit

Fix 1 (Gareth Cronin)

Anyone using log4j/commons etc and JUnit should change the
junit/runner/excluded.properties file inside junit.jar to look like this
(it will get rid of all annoying Jakarta issues):

#
# The list of excluded package paths for the TestCaseClassLoader
#
excluded.0=sun.*
excluded.1=com.sun.*
excluded.2=org.omg.*
excluded.3=javax.*
excluded.4=sunw.*
excluded.5=java.*
excluded.6=org.xml.sax.*
excluded.7=org.w3c.dom.*
excluded.8=org.apache.log4j.*
excluded.9=org.apache.commons.*

Fix 2 (Eric Everman)
Another fix for this is to turn off class reloading [in JUnit].


* How I configure logging?

Hibernate uses the Apache commons-logging abstraction layer to support
whichever logging framework you hapen to be using. See

  http://jakarta.apache.org/commons/logging.html

To configure log4j you need to do 2 things:

1. put log4j.jar in your classpath
2. put log4j.properties in your classpath

There is an example log4j.properties in the hibernate-x.x directory. Just
change "INFO" to "DEBUG" to see more messages (and move it into the
classpath).

To use JDK1.4 logging, do three things:

1. remove log4j.jar from the classpath
2. run under JDK1.4 ;)
3. configure logging via the properties file specified
by the 'java.util.logging.config.file' system property (this property
defaults to $JAVA_HOME/jre/lib/logging.properties)


* How do I configure the cache?

Hibernate uses JCS for its factory-level caching. JCS is configured by
placing a properties file named cache.ccf in the classpath. See

  http://jakarta.apache.org/turbine/jcs/


* Where can I get more help?

  http://sourceforge.net/forum/forum.php?forum_id=128638



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to