diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-11-22 16:50:58 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-11-22 16:50:58 +0100 |
commit | dcda71cc643a628704b4d5840ed35d6552cbc69b (patch) | |
tree | eea9cdeca1ad4e7626bb71edb62efd54234d410d /java-hibernate/cfg | |
parent | be38a2ce3ce51b46cb28c19cc20f178cc5b63169 (diff) | |
download | skeletons-dcda71cc643a628704b4d5840ed35d6552cbc69b.zip skeletons-dcda71cc643a628704b4d5840ed35d6552cbc69b.tar.gz |
add java-hibernate test
Diffstat (limited to 'java-hibernate/cfg')
-rw-r--r-- | java-hibernate/cfg/annotations/hibernate.cfg.xml | 59 | ||||
-rw-r--r-- | java-hibernate/cfg/basic/Event.hbm.xml | 41 | ||||
-rw-r--r-- | java-hibernate/cfg/basic/hibernate.cfg.xml | 58 | ||||
-rw-r--r-- | java-hibernate/cfg/logback-test.xml | 14 |
4 files changed, 172 insertions, 0 deletions
diff --git a/java-hibernate/cfg/annotations/hibernate.cfg.xml b/java-hibernate/cfg/annotations/hibernate.cfg.xml new file mode 100644 index 0000000..43c0bdd --- /dev/null +++ b/java-hibernate/cfg/annotations/hibernate.cfg.xml @@ -0,0 +1,59 @@ +<?xml version='1.0' encoding='utf-8'?> +<!-- + ~ Hibernate, Relational Persistence for Idiomatic Java + ~ + ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as + ~ indicated by the @author tags or express copyright attribution + ~ statements applied by the authors. All third-party contributions are + ~ distributed under license by Red Hat Inc. + ~ + ~ This copyrighted material is made available to anyone wishing to use, modify, + ~ copy, or redistribute it subject to the terms and conditions of the GNU + ~ Lesser General Public License, as published by the Free Software Foundation. + ~ + ~ This program is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + ~ for more details. + ~ + ~ You should have received a copy of the GNU Lesser General Public License + ~ along with this distribution; if not, write to: + ~ Free Software Foundation, Inc. + ~ 51 Franklin Street, Fifth Floor + ~ Boston, MA 02110-1301 USA + --> +<!DOCTYPE hibernate-configuration PUBLIC + "-//Hibernate/Hibernate Configuration DTD 3.0//EN" + "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> + +<hibernate-configuration> + + <session-factory> + + <!-- Database connection settings --> + <property name="connection.driver_class">org.h2.Driver</property> + <property name="connection.url">jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE</property> + <property name="connection.username">sa</property> + <property name="connection.password"></property> + + <!-- JDBC connection pool (use the built-in) --> + <property name="connection.pool_size">1</property> + + <!-- SQL dialect --> + <property name="dialect">org.hibernate.dialect.H2Dialect</property> + + <!-- Disable the second-level cache --> + <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> + + <!-- Echo all executed SQL to stdout --> + <property name="show_sql">true</property> + + <!-- Drop and re-create the database schema on startup --> + <property name="hbm2ddl.auto">create</property> + + <!-- Names the annotated entity class --> + <mapping class="ch.asynk.hibernate.annotations.Event"/> + + </session-factory> + +</hibernate-configuration> diff --git a/java-hibernate/cfg/basic/Event.hbm.xml b/java-hibernate/cfg/basic/Event.hbm.xml new file mode 100644 index 0000000..3e5fbf3 --- /dev/null +++ b/java-hibernate/cfg/basic/Event.hbm.xml @@ -0,0 +1,41 @@ +<?xml version="1.0"?> + +<!-- + ~ Hibernate, Relational Persistence for Idiomatic Java + ~ + ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as + ~ indicated by the @author tags or express copyright attribution + ~ statements applied by the authors. All third-party contributions are + ~ distributed under license by Red Hat Inc. + ~ + ~ This copyrighted material is made available to anyone wishing to use, modify, + ~ copy, or redistribute it subject to the terms and conditions of the GNU + ~ Lesser General Public License, as published by the Free Software Foundation. + ~ + ~ This program is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + ~ for more details. + ~ + ~ You should have received a copy of the GNU Lesser General Public License + ~ along with this distribution; if not, write to: + ~ Free Software Foundation, Inc. + ~ 51 Franklin Street, Fifth Floor + ~ Boston, MA 02110-1301 USA + --> + +<!DOCTYPE hibernate-mapping PUBLIC + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> + +<hibernate-mapping package="ch.asynk.hibernate.basic" auto-import="true"> + + <class name="Event" table="EVENTS"> + <id name="id" column="EVENT_ID"> + <generator class="increment"/> + </id> + <property name="date" type="timestamp" column="EVENT_DATE"/> + <property name="title"/> + </class> + +</hibernate-mapping> diff --git a/java-hibernate/cfg/basic/hibernate.cfg.xml b/java-hibernate/cfg/basic/hibernate.cfg.xml new file mode 100644 index 0000000..b407572 --- /dev/null +++ b/java-hibernate/cfg/basic/hibernate.cfg.xml @@ -0,0 +1,58 @@ +<?xml version='1.0' encoding='utf-8'?> +<!-- + ~ Hibernate, Relational Persistence for Idiomatic Java + ~ + ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as + ~ indicated by the @author tags or express copyright attribution + ~ statements applied by the authors. All third-party contributions are + ~ distributed under license by Red Hat Inc. + ~ + ~ This copyrighted material is made available to anyone wishing to use, modify, + ~ copy, or redistribute it subject to the terms and conditions of the GNU + ~ Lesser General Public License, as published by the Free Software Foundation. + ~ + ~ This program is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + ~ for more details. + ~ + ~ You should have received a copy of the GNU Lesser General Public License + ~ along with this distribution; if not, write to: + ~ Free Software Foundation, Inc. + ~ 51 Franklin Street, Fifth Floor + ~ Boston, MA 02110-1301 USA + --> +<!DOCTYPE hibernate-configuration PUBLIC + "-//Hibernate/Hibernate Configuration DTD 3.0//EN" + "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> + +<hibernate-configuration> + + <session-factory> + + <!-- Database connection settings --> + <property name="connection.driver_class">org.h2.Driver</property> + <property name="connection.url">jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE</property> + <property name="connection.username">sa</property> + <property name="connection.password"></property> + + <!-- JDBC connection pool (use the built-in) --> + <property name="connection.pool_size">1</property> + + <!-- SQL dialect --> + <property name="dialect">org.hibernate.dialect.H2Dialect</property> + + <!-- Disable the second-level cache --> + <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> + + <!-- Echo all executed SQL to stdout --> + <property name="show_sql">true</property> + + <!-- Drop and re-create the database schema on startup --> + <property name="hbm2ddl.auto">create</property> + + <mapping resource="Event.hbm.xml"/> + + </session-factory> + +</hibernate-configuration> diff --git a/java-hibernate/cfg/logback-test.xml b/java-hibernate/cfg/logback-test.xml new file mode 100644 index 0000000..faa53b9 --- /dev/null +++ b/java-hibernate/cfg/logback-test.xml @@ -0,0 +1,14 @@ +<configuration> + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> + <encoder> + <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> + </encoder> + </appender> + + <root level="error"> + <appender-ref ref="STDOUT" /> + </root> + +</configuration> |