
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"[http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.url">jdbc:oracle:thin:@dbServer:1521:db</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.connection.username">dbusername</property>
<property name="hibernate.connection.password">dbpassword</property>
<!-- Configuration hibernate -->
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.query.substitutions">1</property>
<property name="hibernate.connection.autocommit">false</property>
<property name="hibernate.jdbc.batch_size">50</property>
<property name="hibernate.jdbc.use_get_generated_keys">true</property>
<!-- Pool de connexion : ici C3P0 qui est déclaré -->
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="hibernate.c3p0.acquire_increment">3</property>
<property name="hibernate.c3p0.idle_test_period">180</property>
<property name="hibernate.c3p0.max_size">100</property>
<property name="hibernate.c3p0.min_size">10</property>
<property name="hibernate.c3p0.timeout">1000</property>
<!—désactiver la cache deuxième niveau -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!—Liste des fichiers de Mapping hbm -->
<mapping resource="com/org/client/mapping/Client.hbm.xml"/>
</session-factory>
</hibernate-configuration>
CREATE TABLE CLIENT ( ID_Client NUMBER(10) NOT NULL, TITRE VARCHAR2(10), NOM VARCHAR2(30), REMISE NUMBER(19,5), CA NUMBER(19,5), CONSTRAINT PK_CLIENT PRIMARY KEY (CLIENT_ID) );
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class
name="[Nom_Package].Client"
table="CLIENT"
entity-name="Client"
>
<meta attribute="class-description" inherit="false">
@hibernate.class
table="CLIENT"
</meta>
<id
name="idClient"
type="java.lang.Long"
column="ID_CLIENT"
>
<meta attribute="field-description" inherit="false">
Id du client
</meta>
<meta attribute="field-description">
@hibernate.id
generator-class="assigned"
type="java.lang.Long"
column="CLIENT_ID"
</meta>
<generator class="increment" />
</id>
<property
name="titre"
type="java.lang.String"
column="TITRE"
length="10"
>
<meta attribute="field-description" inherit="false">
Titre du client
</meta>
<meta attribute="field-description">
@hibernate.property
column="TITRE"
length="10"
</meta>
</property>
<property
name="name"
type="java.lang.String"
column="NAME"
length="30"
>
<meta attribute="field-description" inherit="false">
Nom du client
</meta>
<meta attribute="field-description">
@hibernate.property
column="NAME"
length="30"
</meta>
</property>
<property
name="remise"
type="java.math.BigDecimal"
column="REMISE"
length="19"
>
<meta attribute="field-description" inherit="false">
Remise du client
</meta>
<meta attribute="field-description">
@hibernate.property
column="REMISE"
length="19"
</meta>
</property>
<property
name="ca"
type="java.math.BigDecimal"
column="CA"
length="19"
>
<meta attribute="field-description" inherit="false">
Chiffre Affaire
</meta>
</class>
</hibernate-mapping>
<composite-id>
<key-property name="attribut1"/>
<key-property name="attribut2"/>
</composite-id>
org.hibernate.Session sess = sessFact.openSession();
Client c = new Client();
c.setName("John");
p.setTitre("Mr");
Transaction tx = sess.beginTransaction();
sess.saveOrUpdate(p);
tx.commit();
sess.close();
Combien cela coûte-t-il au total ? Quelles aides apportent l'état et les acteurs du marché pour alléger cette charge non choisie ? Tous les détails sur Commentçamarche.net.