Hibernate 설정 관련 FAQ

Configuration

Whats the easiest way to configure Hibernate in a plain Java application (without using JNDI)?

Build a SessionFactory from a Configuration object. See the tutorials in the reference documentation.

Whats the easiest way to configure Hibernate in a J2EE application (using JNDI)?

Build a SessionFactory from a Configuration object. See the tutorials in the reference documentation. Specify a name for the SessionFactory in the configuration file, so it will be bound automatically to this name in JNDI.

How do I configure Hibernate as a JMX service in JBoss

See Using Hibernate with JBoss.

How do I use Hibernate in an EJB 2.1 session bean?

1. Look up the SessionFactory in JNDI.

2. Call getCurrentSession() to get a Session for the current transaction.

3. Do your work.

4. Don't commit or close anything, let the container manage the transaction.

How do 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 two 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?

See the Performance Tuning chapter in the reference documentation.

by CHillo | 2009/10/23 21:15 | 트랙백 | 덧글(0)
트랙백 주소 : http://zoonoo.egloos.com/tb/5150124
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]

:         :

:

비공개 덧글

< 이전페이지 다음페이지 >