Index: /ether_ndacc/trunk/persistence/Copy of hibernate.cfg.xml.old
===================================================================
--- /ether_ndacc/trunk/persistence/Copy of hibernate.cfg.xml.old	(revision 105)
+++ /ether_ndacc/trunk/persistence/Copy of hibernate.cfg.xml.old	(revision 105)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+	<!-- sessionFactory -->
+	<bean id="sessionFactory"
+		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
+		<property name="configLocation">
+			<value>classpath:hibernate-domain.cfg.xml</value>
+		</property>
+
+		<property name="configurationClass">
+			<value>org.hibernate.cfg.AnnotationConfiguration</value>
+		</property>
+
+		<property name="hibernateProperties">
+			<props>
+				<prop key="hibernate.bytecode.use_reflection_optimizer">false</prop>
+				<prop key="hibernate.connection.driver_class">org.postgresql.Driver</prop>
+				<prop key="hibernate.connection.url">jdbc:postgresql://darkstar.ipslnet:5432/NAFE_TEST</prop>
+				<prop key="hibernate.connection.username">postgres</prop>
+				<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
+				<prop key="hibernate.show_sql">true</prop>
+
+				<prop key="hibernate.generate_statistics">true</prop>
+			</props>
+		</property>
+	</bean>
+
+	<bean id="transactionManager"
+		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
+		<property name="sessionFactory" ref="sessionFactory" />
+	</bean>
+
+	<bean id="transactionProxy" abstract="true"
+		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
+		<property name="transactionManager">
+			<ref bean="transactionManager" />
+		</property>
+		<property name="transactionAttributes">
+			<props>
+				<prop key="insert*">PROPAGATION_REQUIRED</prop>
+				<prop key="update*">PROPAGATION_REQUIRED</prop>
+				<prop key="save*">PROPAGATION_REQUIRED</prop>
+				<prop key="*">PROPAGATION_REQUIRED, readOnly</prop>
+			</props>
+		</property>
+	</bean>
+
+	<!-- <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> -->
+	<!-- <property name="sessionFactory" ref="sessionFactory" /> -->
+	<!-- </bean> -->
+
+</beans>
Index: /ether_ndacc/trunk/persistence/dao-context.xml
===================================================================
--- /ether_ndacc/trunk/persistence/dao-context.xml	(revision 105)
+++ /ether_ndacc/trunk/persistence/dao-context.xml	(revision 105)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<!-- Application context DAO layer -->
+<beans>
+	<bean id="refStationDAO" class="com.ether.dao.station.StationDAOImpl">
+		<property name="sessionFactory">
+			<ref bean="sessionFactory" />
+		</property>
+	</bean>
+
+	<bean id="refInstrumentDAO" class="com.ether.dao.instrument.InstrumentDAOImpl">
+		<property name="sessionFactory">
+			<ref bean="sessionFactory" />
+		</property>
+	</bean>
+
+	<bean id="refPlotDAO" class="com.ether.dao.plot.PlotDAOImpl">
+		<property name="sessionFactory">
+			<ref bean="sessionFactory" />
+		</property>
+	</bean>
+
+</beans>
Index: /ether_ndacc/trunk/persistence/hibernate-domain.cfg.xml
===================================================================
--- /ether_ndacc/trunk/persistence/hibernate-domain.cfg.xml	(revision 105)
+++ /ether_ndacc/trunk/persistence/hibernate-domain.cfg.xml	(revision 105)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE hibernate-configuration PUBLIC
+        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<hibernate-configuration>
+	<session-factory>
+		<mapping resource="com/ether/dao/station/Station.hbm.xml" />
+		<mapping resource="com/ether/dao/instrument/Instrument.hbm.xml" />
+		<mapping resource="com/ether/dao/plot/Plot.hbm.xml" />
+	</session-factory>
+</hibernate-configuration>
Index: /ether_ndacc/trunk/persistence/hibernate.cfg.xml
===================================================================
--- /ether_ndacc/trunk/persistence/hibernate.cfg.xml	(revision 105)
+++ /ether_ndacc/trunk/persistence/hibernate.cfg.xml	(revision 105)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+	<!-- sessionFactory -->
+	<bean id="sessionFactory"
+		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
+		<property name="configLocation">
+			<value>classpath:hibernate-domain.cfg.xml</value>
+		</property>
+
+		<property name="configurationClass">
+			<value>org.hibernate.cfg.AnnotationConfiguration</value>
+		</property>
+
+		<property name="hibernateProperties">
+			<props>
+				<prop key="hibernate.bytecode.use_reflection_optimizer">false</prop>
+				<prop key="hibernate.connection.driver_class">org.postgresql.Driver</prop>
+				<prop key="hibernate.connection.url">jdbc:postgresql://darkstar.ipslnet:5432/NAFE_TEST</prop>
+				<prop key="hibernate.connection.username">postgres</prop>
+				<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
+				<prop key="hibernate.show_sql">true</prop>
+
+				<prop key="hibernate.generate_statistics">true</prop>
+			</props>
+		</property>
+	</bean>
+
+	<bean id="transactionManager"
+		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
+		<property name="sessionFactory" ref="sessionFactory" />
+	</bean>
+
+	<bean id="transactionProxy" abstract="true"
+		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
+		<property name="transactionManager">
+			<ref bean="transactionManager" />
+		</property>
+		<property name="transactionAttributes">
+			<props>
+				<prop key="insert*">PROPAGATION_REQUIRED</prop>
+				<prop key="update*">PROPAGATION_REQUIRED</prop>
+				<prop key="save*">PROPAGATION_REQUIRED</prop>
+				<prop key="*">PROPAGATION_REQUIRED, readOnly</prop>
+			</props>
+		</property>
+	</bean>
+
+	<!-- <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> -->
+	<!-- <property name="sessionFactory" ref="sessionFactory" /> -->
+	<!-- </bean> -->
+
+</beans>
Index: /ether_ndacc/trunk/persistence/hibernate_test.cfg.xml
===================================================================
--- /ether_ndacc/trunk/persistence/hibernate_test.cfg.xml	(revision 105)
+++ /ether_ndacc/trunk/persistence/hibernate_test.cfg.xml	(revision 105)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+	<!-- sessionFactory -->
+	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
+		<property name="configLocation">
+			<value>classpath:hibernate-domain.cfg.xml</value>
+		</property>
+
+		<property name="configurationClass">
+			<value>org.hibernate.cfg.AnnotationConfiguration</value>
+		</property>
+
+		<property name="hibernateProperties">
+			<props>
+				<prop key="hibernate.bytecode.use_reflection_optimizer">false</prop>
+				<prop key="hibernate.connection.driver_class">org.postgresql.Driver</prop>
+				<prop key="hibernate.connection.url">jdbc:postgresql://darkstar.ipslnet:5432/NAFE_TEST</prop>
+				<prop key="hibernate.connection.username">postgres</prop>
+				<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
+				<prop key="hibernate.show_sql">true</prop>
+
+				<prop key="hibernate.generate_statistics">true</prop>
+			</props>
+		</property>
+	</bean>
+
+	<bean id="transactionManager"
+		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
+		<property name="sessionFactory" ref="sessionFactory" />
+	</bean>
+
+	<bean id="transactionProxy" abstract="true"
+		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
+		<property name="transactionManager">
+			<ref bean="transactionManager" />
+		</property>
+		<property name="transactionAttributes">
+			<props>
+				<prop key="insert*">PROPAGATION_REQUIRED</prop>
+				<prop key="update*">PROPAGATION_REQUIRED</prop>
+				<prop key="save*">PROPAGATION_REQUIRED</prop>
+				<prop key="*">PROPAGATION_REQUIRED, readOnly</prop>
+			</props>
+		</property>
+	</bean>
+
+</beans>
Index: /ether_ndacc/trunk/persistence/implementation/com/ether/EnumUserType.java
===================================================================
--- /ether_ndacc/trunk/persistence/implementation/com/ether/EnumUserType.java	(revision 105)
+++ /ether_ndacc/trunk/persistence/implementation/com/ether/EnumUserType.java	(revision 105)
@@ -0,0 +1,58 @@
+package com.ether;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hibernate.HibernateException;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+
+/**
+ * The enum user type.
+ */
+public abstract class EnumUserType<E extends Enum<E>> extends SimpleUserType
+{
+    protected EnumUserType(final Class<E> clazz) {
+	_clazz = clazz;
+    }
+
+    public int[] sqlTypes() {
+	return SQL_TYPES;
+    }
+
+    public Class returnedClass() {
+	return _clazz;
+    }
+
+    public Object nullSafeGet(final ResultSet resultSet, final String[] names,
+	    final Object owner) throws HibernateException, SQLException {
+	final String name = resultSet.getString(names[0]);
+	E result = null;
+	if (!resultSet.wasNull()) {
+	    result = Enum.valueOf(_clazz, name);
+	}
+	return result;
+    }
+
+    public void nullSafeSet(final PreparedStatement preparedStatement,
+	    final Object value, final int index) throws HibernateException,
+	    SQLException {
+	if (null == value) {
+	    HIBERNATE_TYPE_LOGGER.trace("binding null to parameter: " + index);
+	    preparedStatement.setNull(index, Types.NVARCHAR);
+	} else {
+	    final String stringValue = ((Enum) value).name();
+	    HIBERNATE_TYPE_LOGGER.trace("binding '" + stringValue
+		    + "' to parameter: " + index);
+	    preparedStatement.setString(index, stringValue);
+	}
+    }
+
+    private static final Log HIBERNATE_TYPE_LOGGER = LogFactory.getLog(org.hibernate.type.Type.class);
+
+    private static final int[] SQL_TYPES = { Types.NVARCHAR };
+
+    private Class<E> _clazz = null;
+}
Index: /ether_ndacc/trunk/persistence/implementation/com/ether/SimpleUserType.java
===================================================================
--- /ether_ndacc/trunk/persistence/implementation/com/ether/SimpleUserType.java	(revision 105)
+++ /ether_ndacc/trunk/persistence/implementation/com/ether/SimpleUserType.java	(revision 105)
@@ -0,0 +1,41 @@
+package com.ether;
+
+import org.hibernate.usertype.UserType;
+import org.hibernate.HibernateException;
+
+import java.io.Serializable;
+
+public abstract class SimpleUserType implements UserType
+{
+    public Object deepCopy(final Object value) throws HibernateException {
+	return value;
+    }
+
+    public boolean isMutable() {
+	return false;
+    }
+
+    public Object assemble(final Serializable cached, final Object owner)
+	    throws HibernateException {
+	return cached;
+    }
+
+    public Serializable disassemble(final Object value)
+	    throws HibernateException {
+	return (Serializable) value;
+    }
+
+    public Object replace(final Object original, final Object target,
+	    final Object owner) throws HibernateException {
+	return original;
+    }
+
+    public int hashCode(final Object object) throws HibernateException {
+	return object.hashCode();
+    }
+
+    public boolean equals(final Object x, final Object y)
+	    throws HibernateException {
+	return x == y || !(null == x || null == y) && x.equals(y);
+    }
+}
Index: /ether_ndacc/trunk/persistence/implementation/com/ether/dao/DomainAccessObjectImpl.java
===================================================================
--- /ether_ndacc/trunk/persistence/implementation/com/ether/dao/DomainAccessObjectImpl.java	(revision 105)
+++ /ether_ndacc/trunk/persistence/implementation/com/ether/dao/DomainAccessObjectImpl.java	(revision 105)
@@ -0,0 +1,331 @@
+package com.ether.dao;
+
+import static com.ether.PersistenceUtils.convert;
+import static com.ether.PersistenceUtils.uniqueResult;
+
+import java.io.Serializable;
+import java.lang.reflect.ParameterizedType;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.criterion.DetachedCriteria;
+import org.hibernate.criterion.Example;
+import org.hibernate.criterion.Projections;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.springframework.dao.DataAccessException;
+
+import com.ether.PersistenceException;
+
+public class DomainAccessObjectImpl<DO, PK extends Serializable>
+	implements DomainAccessObject<DO, PK>
+{
+    public DomainAccessObjectImpl(final Class<DO> domainObjectClass) {
+	_domainObjectClass = domainObjectClass;
+    }
+
+    // ************************************************************************** //
+    // ******************************* REQUESTS ********************************* //
+    // ************************************************************************** //
+
+    // ******************************* SELECT BY CRITERIA **//    
+    @Nullable
+    public final DO selectByCriteria(final DetachedCriteria criteria)
+	    throws PersistenceException
+    {
+	return selectByCriteria(getDomainObjectClass(), criteria);
+    }
+
+    @Nullable
+    public final <O> O selectByCriteria(final Class<O> objectClass, final DetachedCriteria criteria) throws PersistenceException
+    {
+	return (O) criteria.getExecutableCriteria(_sessionFactory.getCurrentSession()).uniqueResult();	
+    }
+
+    @NotNull
+    public final <O> List<O> selectAllByCriteria(final Class<O> objectClass, final DetachedCriteria criteria) throws PersistenceException
+    {
+	final List<O> result =  (List<O>) criteria.getExecutableCriteria(_sessionFactory.getCurrentSession()).list();
+	return null != result ? result : new ArrayList<O>();
+    }
+
+    @NotNull
+    public final List<DO> selectAllByCriteria(final DetachedCriteria criteria)
+	    throws PersistenceException
+    {
+	return selectAllByCriteria(getDomainObjectClass(), criteria);
+    }
+
+    
+    // ******************************* INSERT **//    
+    @NotNull
+    public final PK insert(final DO domainObject) throws PersistenceException
+    {
+	try
+	{
+	    final Session session = _sessionFactory.getCurrentSession();
+	    final PK primaryKey = (PK) session.save(domainObject);
+	    session.flush();
+	    return primaryKey;
+	}
+	catch (DataAccessException e)
+	{
+	    throw convert(e);
+	}
+    }
+
+    public final void insertAll(@NotNull final Collection<DO> domainObjects)
+	    throws PersistenceException
+    {
+	try
+	{
+	    final Session session = _sessionFactory.getCurrentSession();
+	    int i = 0;
+	    for (final DO domainObject : domainObjects)
+	    {
+		session.save(domainObject);
+		// Avoid OutOfMemoryError
+		if (i >= 500)
+		{
+		    session.flush();
+		    session.clear();
+		    i = 0;
+		}
+	    }
+	    session.flush();
+	}
+	catch (DataAccessException e)
+	{
+	    throw convert(e);
+	}
+    }
+
+    // ******************************* UPDATE **//    
+    public void update(@NotNull final DO domainObject)
+	    throws PersistenceException
+    {
+	try
+	{
+	    final Session session = _sessionFactory.getCurrentSession();
+	    session.update(domainObject);
+	    session.flush();
+	}
+	catch (DataAccessException e)
+	{
+	    throw convert(e);
+	}
+    }
+
+    public final void updateAll(final Collection<? extends DO> domainObjects)
+	    throws PersistenceException
+    {
+	try
+	{
+	    final Session session = _sessionFactory.getCurrentSession();
+	    for (final DO domainObject : domainObjects)
+		session.saveOrUpdate(domainObject);
+	    session.flush();
+	}
+	catch (DataAccessException e)
+	{
+	    throw convert(e);
+	}
+    }
+
+    // ******************************* UPGRADE **//    
+    public final void upgrade(final DO domainObject)
+	    throws PersistenceException
+    {
+	try
+	{
+	    final Session session = _sessionFactory.getCurrentSession();
+	    session.refresh(domainObject);
+	    session.flush();
+	}
+	catch (DataAccessException e)
+	{
+	    throw convert(e);
+	}
+    }
+
+    public final void upgradeAll(final Collection<DO> domainObjects)
+	    throws PersistenceException
+    {
+	try
+	{
+	    final Session session = _sessionFactory.getCurrentSession();
+	    for (final DO domainObject : domainObjects)
+	    {
+		session.refresh(domainObject);
+	    }
+	    session.flush();
+	}
+	catch (DataAccessException e)
+	{
+	    throw convert(e);
+	}
+    }
+
+    // ******************************* DELETE **//    
+    public void deleteByPrimaryKey(final PK primaryKey)
+	    throws PersistenceException
+    {
+	try
+	{
+	    final Session session = _sessionFactory.getCurrentSession();
+	    final Object domainObject = session.get(getDomainObjectClass(), primaryKey);
+	    if(null != domainObject)
+		session.delete(domainObject);
+	    else
+		throw new PersistenceException(PersistenceException.PersistenceCode.OBJECT_TO_DELETE_NOT_FOUND);
+	    session.flush();
+	}
+	catch (DataAccessException e)
+	{
+	    throw convert(e);
+	}
+    }
+
+    public final void delete(@NotNull final DO domainObject)
+	    throws PersistenceException
+    {
+	try
+	{
+	    final Session session = _sessionFactory.getCurrentSession();
+	    session.delete(domainObject);
+	    session.flush();
+	}
+	catch (DataAccessException e)
+	{
+	    throw convert(e);
+	}
+    }
+
+    public final void deleteAll(final Collection<DO> domainObjects)
+	    throws PersistenceException
+    {
+	try
+	{
+	    final Session session = _sessionFactory.getCurrentSession();
+	    for (final DO domainObject : domainObjects)
+		session.delete(domainObject);
+	    session.flush();
+	}
+	catch (DataAccessException e)
+	{
+	    throw convert(e);
+	}
+    }
+
+    // ******************************* SELECT **//    
+    public final DO selectByPrimaryKey(@NotNull final PK primaryKey)
+	    throws PersistenceException
+    {
+	try
+	{
+	    final Session session = _sessionFactory.getCurrentSession();
+	    return (DO) session.get(getDomainObjectClass(), primaryKey);
+	}
+	catch (DataAccessException e)
+	{
+	    throw convert(e);
+	}
+    }
+
+    public final DO selectByExample(final DO domainObject)
+	    throws PersistenceException
+    {
+	final Session session = _sessionFactory.getCurrentSession();
+	final Criteria executableCriteria = session.createCriteria(domainObject.getClass());
+	executableCriteria.add(Example.create(domainObject));
+	return uniqueResult((Collection<DO>) executableCriteria.list());
+    }
+
+    public final List<DO> selectAllByExample(final DO domainObject)
+	    throws PersistenceException
+    {
+	final Session session = _sessionFactory.getCurrentSession();
+	final Criteria executableCriteria = session.createCriteria(domainObject.getClass());
+	executableCriteria.add(Example.create(domainObject));
+	return (List<DO>) executableCriteria.list();
+    }
+
+    public final List<DO> selectAll() throws PersistenceException
+    {
+	try
+	{
+	    final Session session = _sessionFactory.getCurrentSession();
+	    final Criteria executableCriteria = session.createCriteria(getDomainObjectClass());	    
+	    return (List<DO>) executableCriteria.list();
+	}
+	catch (DataAccessException e)
+	{
+	    throw convert(e);
+	}
+    }
+
+    // ******************************* PAGINATE **//
+    protected <T> List<T> selectPage(@Nullable final Integer firstResult, @Nullable final Integer maxResults, final DetachedCriteria detachedCriteria)
+	    throws PersistenceException
+    {
+	final Session session = _sessionFactory.getCurrentSession();
+	final Criteria criteria = detachedCriteria.getExecutableCriteria(session);
+
+	if (null != maxResults)
+	{
+	    criteria.setMaxResults(maxResults);
+	    if (null != firstResult)
+		criteria.setFirstResult(firstResult);
+	}
+	return (List<T>) criteria.list();
+    }
+
+    protected Integer count(final DetachedCriteria detachedCriteria)
+	    throws PersistenceException
+    {
+	final Session session = _sessionFactory.getCurrentSession();
+	final Criteria executableCriteria = detachedCriteria.getExecutableCriteria(session);
+	executableCriteria.setProjection(Projections.rowCount());
+	return (Integer) executableCriteria.uniqueResult();
+    }
+    // ************************************************************************** //
+    // ************************************************************************** //
+    
+    @SuppressWarnings("unchecked")
+    public final Class<DO> getDomainObjectClass()
+    {
+	if (_domainObjectClass == null)
+	{
+	    if (getClass().getGenericSuperclass() instanceof ParameterizedType)
+		_domainObjectClass = (Class<DO>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
+	    else
+		throw new IllegalArgumentException("domain class is not null and DAO is not parameterized !");
+	}
+
+	return _domainObjectClass;
+    }
+
+    public final void setDomainObjectClass(final Class<DO> domainObjectClass)
+    {
+	_domainObjectClass = domainObjectClass;
+    }
+
+    public final void setSessionFactory(final SessionFactory sessionFactory)
+    {
+	_sessionFactory = sessionFactory;
+    }
+
+    public final SessionFactory getSessionFactory()
+    {
+    	return _sessionFactory;
+    }
+
+    protected static final Integer MAX_RESULTS_FOR_PAGINATION = 100;
+
+    private SessionFactory _sessionFactory;
+    private Class<DO> _domainObjectClass;
+}
Index: /ether_ndacc/trunk/persistence/implementation/com/ether/dao/instrument/Instrument.hbm.xml
===================================================================
--- /ether_ndacc/trunk/persistence/implementation/com/ether/dao/instrument/Instrument.hbm.xml	(revision 105)
+++ /ether_ndacc/trunk/persistence/implementation/com/ether/dao/instrument/Instrument.hbm.xml	(revision 105)
@@ -0,0 +1,32 @@
+<?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 default-cascade="save-update" auto-import="false">
+
+	<class name="com.ether.instrument.Instrument" table="ND_INSTRUMENT">
+
+		<id name="id">
+			<column name="in_id" />
+			<generator class="increment" />
+
+			<!-- <generator class="sequence"> -->
+			<!-- <param name="sequence">S_TABLE_TEST</param> -->
+			<!-- </generator> -->
+		</id>
+
+		<property name="name">
+			<column name="in_name"/>
+		</property>
+
+        <property name="type" type="com.ether.dao.instrument.InstrumentTypeUserType">
+            <column name="in_type"/>
+        </property>
+
+        <many-to-one name="station" class="com.ether.station.Station" lazy="false">
+            <column name="st_id"/>
+        </many-to-one>
+        
+	</class>
+	
+</hibernate-mapping>
+
Index: /ether_ndacc/trunk/persistence/implementation/com/ether/dao/instrument/InstrumentDAOImpl.java
===================================================================
--- /ether_ndacc/trunk/persistence/implementation/com/ether/dao/instrument/InstrumentDAOImpl.java	(revision 105)
+++ /ether_ndacc/trunk/persistence/implementation/com/ether/dao/instrument/InstrumentDAOImpl.java	(revision 105)
@@ -0,0 +1,52 @@
+package com.ether.dao.instrument;
+
+import java.util.List;
+
+import org.hibernate.criterion.DetachedCriteria;
+import org.hibernate.criterion.Projections;
+import org.hibernate.criterion.Restrictions;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import com.ether.PersistenceException;
+import com.ether.dao.DomainAccessObjectImpl;
+import com.ether.instrument.Instrument;
+import com.ether.instrument.InstrumentType;
+
+/**
+ * @author vmipsl
+ * @date 24 jan 2011
+ */
+public class InstrumentDAOImpl extends DomainAccessObjectImpl<Instrument, Long>
+	implements InstrumentDAO
+{
+    protected InstrumentDAOImpl() {
+	super(Instrument.class);
+    }
+
+    public Integer getNbInstruments() throws PersistenceException
+    {
+	final DetachedCriteria criteria = DetachedCriteria.forClass(Instrument.class)
+		.setProjection(Projections.property("id"));
+
+	return count(criteria);
+    }
+
+    @Nullable
+    public List<Instrument> getInstrumentsByStationId( @NotNull final Long stationId ) throws PersistenceException
+    {
+	final DetachedCriteria criteria = DetachedCriteria.forClass(Instrument.class)
+		.add(Restrictions.eq("station.id", stationId));
+
+	return selectAllByCriteria(Instrument.class, criteria);
+    }
+
+    @Nullable
+    public List<Instrument> getInstrumentsByType( @NotNull final InstrumentType type ) throws PersistenceException
+    {
+	final DetachedCriteria criteria = DetachedCriteria.forClass(Instrument.class)
+		.add(Restrictions.eq("type", type));
+
+	return selectAllByCriteria(Instrument.class, criteria);
+    }
+}
Index: /ether_ndacc/trunk/persistence/implementation/com/ether/dao/instrument/InstrumentTypeUserType.java
===================================================================
--- /ether_ndacc/trunk/persistence/implementation/com/ether/dao/instrument/InstrumentTypeUserType.java	(revision 105)
+++ /ether_ndacc/trunk/persistence/implementation/com/ether/dao/instrument/InstrumentTypeUserType.java	(revision 105)
@@ -0,0 +1,15 @@
+package com.ether.dao.instrument;
+
+import com.ether.EnumUserType;
+import com.ether.instrument.InstrumentType;
+
+/**
+ * @author vmipsl
+ * @date 24 jan 2011 
+ */
+public class InstrumentTypeUserType extends EnumUserType<InstrumentType>
+{
+    public InstrumentTypeUserType() {
+	super(InstrumentType.class);
+    }
+}
Index: /ether_ndacc/trunk/persistence/implementation/com/ether/dao/plot/Plot.hbm.xml
===================================================================
--- /ether_ndacc/trunk/persistence/implementation/com/ether/dao/plot/Plot.hbm.xml	(revision 105)
+++ /ether_ndacc/trunk/persistence/implementation/com/ether/dao/plot/Plot.hbm.xml	(revision 105)
@@ -0,0 +1,44 @@
+<?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 default-cascade="save-update" auto-import="false">
+	
+	<class name="com.ether.plot.Plot" table="ND_PLOT">
+
+		<id name="id">
+			<column name="pl_id" />
+			<generator class="increment" />
+
+			<!-- <generator class="sequence"> -->
+			<!-- <param name="sequence">S_TABLE_TEST</param> -->
+			<!-- </generator> -->
+		</id>
+		
+		
+		<property name="name">
+			<column name="pl_name" />
+		</property>
+
+		<property name="granulo">
+			<column name="pl_granulo" />
+		</property>
+
+		<property name="datedeb">
+			<column name="pl_datedeb_mes" />
+		</property>
+
+		<property name="datefin">
+			<column name="pl_datefin_mes" />
+		</property>
+		
+		 <property name="type" type="com.ether.dao.plot.PlotTypeUserType">
+            <column name="pl_type"/>
+        </property>
+        
+        <many-to-one name="instrument" class="com.ether.instrument.Instrument" lazy="false">
+            <column name="in_id"/>
+        </many-to-one>
+        
+	</class>
+	
+</hibernate-mapping>
Index: /ether_ndacc/trunk/persistence/implementation/com/ether/dao/plot/PlotDAOImpl.java
===================================================================
--- /ether_ndacc/trunk/persistence/implementation/com/ether/dao/plot/PlotDAOImpl.java	(revision 105)
+++ /ether_ndacc/trunk/persistence/implementation/com/ether/dao/plot/PlotDAOImpl.java	(revision 105)
@@ -0,0 +1,98 @@
+package com.ether.dao.plot;
+
+import java.util.Date;
+import java.util.List;
+
+import org.hibernate.criterion.DetachedCriteria;
+import org.hibernate.criterion.MatchMode;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Projections;
+import org.hibernate.criterion.Restrictions;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import com.ether.PersistenceException;
+import com.ether.dao.DomainAccessObjectImpl;
+import com.ether.plot.Plot;
+
+public class PlotDAOImpl extends DomainAccessObjectImpl<Plot, Long> implements PlotDAO {
+	
+	public PlotDAOImpl() {
+		super(Plot.class);
+	}
+	
+	@Nullable
+	public List<String> getPlotsByDateByInstrumentByStation(@NotNull final String instrument, @NotNull final Date pFormatDate_deb, @NotNull final Date pFormatDate_fin, @NotNull final String station) 
+		throws PersistenceException 
+	{
+		
+		final DetachedCriteria criteria = DetachedCriteria.forClass(Plot.class,"plot")
+			.addOrder(Order.asc("plot.name"))
+			.add(Restrictions.ge("datedeb", pFormatDate_deb))
+			.add(Restrictions.lt("datedeb", pFormatDate_fin))
+			.createCriteria("instrument","instrument").add(Restrictions.ilike("instrument.name",instrument,MatchMode.ANYWHERE))
+			.createCriteria("station","station").add(Restrictions.ilike("station.name",station,MatchMode.ANYWHERE));
+		
+		
+		
+		//select pl_name de nd_plot
+		criteria.setProjection(Projections.property("plot.name"));
+		
+		return selectAllByCriteria(String.class, criteria);
+	}
+
+	@Nullable
+	public List<String> getPlotsByDateByInstrument(@NotNull final String instrument, @NotNull final Date pFormatDate_deb, @NotNull final Date pFormatDate_fin) 
+		throws PersistenceException 
+	{
+		final DetachedCriteria criteria = DetachedCriteria.forClass(Plot.class);
+		criteria.add(Restrictions.ge("datedeb", pFormatDate_deb));
+		criteria.add(Restrictions.lt("datedeb", pFormatDate_fin));
+		criteria.createCriteria("instrument").add(Restrictions.like("name",instrument));		
+
+		//select pl_name de nd_plot
+		criteria.setProjection(Projections.property("name"));
+	
+		return selectAllByCriteria(String.class, criteria);
+	}
+
+	@Nullable
+	public List<Date> getDatesByInstrument(@NotNull final String instrument) 
+		throws PersistenceException 
+	{
+		final DetachedCriteria criteria = DetachedCriteria.forClass(Plot.class);
+		criteria.addOrder(Order.asc("datedeb"));
+		criteria.createCriteria("instrument").add(Restrictions.like("name",instrument));
+	
+		//select pl_name de nd_plot
+		criteria.setProjection(Projections.property("datedeb"));
+	
+		return selectAllByCriteria(Date.class, criteria);
+	}
+
+	@Nullable
+	public Date getLastDateByInstrumentByStation(@NotNull final String instrument, @NotNull final String station) 
+		throws PersistenceException 
+	{
+		final DetachedCriteria criteria = DetachedCriteria.forClass(Plot.class,"plot")
+			.createCriteria("instrument","instrument").add(Restrictions.ilike("instrument.name",instrument,MatchMode.ANYWHERE))
+			.createCriteria("station", "station").add(Restrictions.ilike("station.name",station,MatchMode.ANYWHERE));
+	
+		criteria.setProjection(Projections.property("plot.datedeb"));
+		criteria.addOrder(Order.asc("plot.datedeb"));
+	
+		//	return selectByCriteria(Date.class, criteria);
+		return (Date)criteria.getExecutableCriteria(getSessionFactory().getCurrentSession()).setMaxResults(1).uniqueResult();
+	}
+
+	@Nullable
+	public List<Date> getListeDistinctDates() 
+		throws PersistenceException 
+	{
+		//correspond au select from
+		final DetachedCriteria criteria = DetachedCriteria.forClass(Plot.class)
+			.setProjection(Projections.distinct(Projections.property("datedeb")));
+	
+		return selectAllByCriteria(Date.class, criteria);
+	}
+}
Index: /ether_ndacc/trunk/persistence/implementation/com/ether/dao/plot/PlotTypeUserType.java
===================================================================
--- /ether_ndacc/trunk/persistence/implementation/com/ether/dao/plot/PlotTypeUserType.java	(revision 105)
+++ /ether_ndacc/trunk/persistence/implementation/com/ether/dao/plot/PlotTypeUserType.java	(revision 105)
@@ -0,0 +1,15 @@
+package com.ether.dao.plot;
+
+import com.ether.EnumUserType;
+import com.ether.plot.PlotType;
+
+/**
+ * @author vmipsl // dedicace
+ * @date 24 jan 2011 
+ */
+public class PlotTypeUserType extends EnumUserType<PlotType>
+{
+    public PlotTypeUserType() {
+	super(PlotType.class);
+    }
+}
Index: /ether_ndacc/trunk/persistence/implementation/com/ether/dao/station/Station.hbm.xml
===================================================================
--- /ether_ndacc/trunk/persistence/implementation/com/ether/dao/station/Station.hbm.xml	(revision 105)
+++ /ether_ndacc/trunk/persistence/implementation/com/ether/dao/station/Station.hbm.xml	(revision 105)
@@ -0,0 +1,34 @@
+<?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 default-cascade="save-update" auto-import="false">
+	
+	<class name="com.ether.station.Station" table="ND_STATION">
+
+		<id name="id">
+			<column name="st_id" />
+			<generator class="increment" />
+
+			<!-- <generator class="sequence"> -->
+			<!-- <param name="sequence">S_TABLE_TEST</param> -->
+			<!-- </generator> -->
+		</id>
+
+		<property name="name">
+			<column name="st_name" />
+		</property>
+
+		<property name="latitude">
+			<column name="st_latitude" />
+		</property>
+
+		<property name="longitude">
+			<column name="st_longitude" />
+		</property>
+
+		<property name="altitude">
+			<column name="st_altitude" />
+		</property>
+	</class>
+	
+</hibernate-mapping>
Index: /ether_ndacc/trunk/persistence/implementation/com/ether/dao/station/StationDAOImpl.java
===================================================================
--- /ether_ndacc/trunk/persistence/implementation/com/ether/dao/station/StationDAOImpl.java	(revision 105)
+++ /ether_ndacc/trunk/persistence/implementation/com/ether/dao/station/StationDAOImpl.java	(revision 105)
@@ -0,0 +1,53 @@
+package com.ether.dao.station;
+
+import java.util.List;
+
+import org.hibernate.criterion.DetachedCriteria;
+import org.hibernate.criterion.Projections;
+import org.hibernate.criterion.Restrictions;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import com.ether.PersistenceException;
+import com.ether.dao.DomainAccessObjectImpl;
+import com.ether.station.Station;
+
+/**
+ * @author vmipsl
+ * @date 24 jan 2011
+ */
+public class StationDAOImpl extends DomainAccessObjectImpl<Station, Long>
+	implements StationDAO
+{
+    protected StationDAOImpl() {
+	super( Station.class );
+    }
+
+    @NotNull
+    public Integer getNbStations() throws PersistenceException
+    {
+	final DetachedCriteria criteria = DetachedCriteria.forClass(Station.class)
+		.setProjection(Projections.property("id"));
+
+	return count(criteria);
+    }
+
+    @Nullable 
+    public List<Station> getStationsByAltitude(@NotNull final String altitude) throws PersistenceException
+    {
+	final DetachedCriteria criteria = DetachedCriteria.forClass(Station.class)
+		.add(Restrictions.eq("altitude", altitude));
+	
+	return selectAllByCriteria(Station.class, criteria);
+    }
+    
+    @Nullable 
+    public Station getStationByName(@NotNull final String stationName) throws PersistenceException
+    {
+	final DetachedCriteria criteria = DetachedCriteria.forClass(Station.class)
+		.add(Restrictions.eq("name", stationName));
+	
+	return selectByCriteria(Station.class, criteria); // renvoie une avec ALL renvoie une liste
+    }
+
+}
Index: /ether_ndacc/trunk/persistence/interface/com/ether/PersistenceException.java
===================================================================
--- /ether_ndacc/trunk/persistence/interface/com/ether/PersistenceException.java	(revision 105)
+++ /ether_ndacc/trunk/persistence/interface/com/ether/PersistenceException.java	(revision 105)
@@ -0,0 +1,46 @@
+package com.ether;
+
+/**
+ * @author vmipsl
+ * @date 28 jan 2011
+ */
+@SuppressWarnings("serial")
+public class PersistenceException
+        extends FormattedException
+{
+    public PersistenceException( final PersistenceCode code, final Throwable throwable, final Object... parameters )
+    {
+        this( code, DEFAULT_MESSAGE, throwable, parameters );
+    }
+
+    public PersistenceException( final PersistenceCode code, final Object... parameters )
+    {
+        this( code, DEFAULT_MESSAGE, DEFAULT_THROWABLE, parameters );
+    }
+    
+    protected PersistenceException( final PersistenceCode code, final String message, final Throwable throwable, final Object... parameters )
+    {
+        super( code, message, throwable, parameters );
+    }
+
+    protected PersistenceException( final PersistenceCode code, final String message, final Object... parameters )
+    {
+        super( code, message, DEFAULT_THROWABLE, parameters );
+    }
+    
+    public static enum PersistenceCode implements Code
+    {
+        UNKNOWN_FAILURE,
+        CLEANUP_FAILURE,
+        CONCURRENCY_FAILURE,
+        RESOURCE_FAILURE,
+        INTEGRITY_VIOLATION,
+        RETRIEVAL_FAILURE,
+        DATA_SOURCE_LOOKUP_FAILURE,
+        INVALID_API_USAGE,
+        INVALID_RESOURCE_USAGE,
+        PERMISSION_DENIED,
+        INVALID_ARGUMENT,
+        OBJECT_TO_DELETE_NOT_FOUND,
+    }
+}
Index: /ether_ndacc/trunk/persistence/interface/com/ether/PersistenceUtils.java
===================================================================
--- /ether_ndacc/trunk/persistence/interface/com/ether/PersistenceUtils.java	(revision 105)
+++ /ether_ndacc/trunk/persistence/interface/com/ether/PersistenceUtils.java	(revision 105)
@@ -0,0 +1,108 @@
+package com.ether;
+
+import java.util.Collection;
+import com.ether.PersistenceException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.dao.CleanupFailureDataAccessException;
+import org.springframework.dao.DataAccessException;
+
+public final class PersistenceUtils
+{
+    /**
+     * Returns an unique result from a collection of results.
+     * 
+     * @throws PersistenceException : if more than one result is contained in the collection an exception is thrown.
+     */
+    public static <O> O uniqueResult(final Collection<O> results)
+	    throws PersistenceException
+    {
+	if (results == null || results.isEmpty())
+	    return null;
+	else if (results.size() > 1)
+	    throw new PersistenceException(PersistenceException.PersistenceCode.INVALID_API_USAGE, "unique result expected !");
+	else
+	    return results.iterator().next();
+    }
+
+    public static <O> O firstResult(final Collection<O> results)
+    {
+	if (results == null || results.isEmpty()) return null;
+	return results.iterator().next();
+    }
+  
+    /**
+     * Converts an exception to a DAO exception.
+     * 
+     * @param exception : the exception.
+     * @return the DAO exception.
+     */
+    public static PersistenceException convert(final Exception exception)
+    {
+	// Propagates the exception if exception is persistence exception
+	if (exception instanceof PersistenceException)
+	    return (PersistenceException) exception;
+
+	// Rewraps exception if data access exception
+	final PersistenceException.PersistenceCode code;
+
+	if (exception instanceof DataAccessException)
+	{
+	    if (exception instanceof CleanupFailureDataAccessException)
+	    {
+		code = PersistenceException.PersistenceCode.CLEANUP_FAILURE;
+	    }
+	    else if (exception instanceof org.springframework.dao.ConcurrencyFailureException)
+	    {
+		code = PersistenceException.PersistenceCode.CONCURRENCY_FAILURE;
+	    }
+	    else if (exception instanceof org.springframework.dao.DataAccessResourceFailureException)
+	    {
+		code = PersistenceException.PersistenceCode.RESOURCE_FAILURE;
+	    }
+	    else if (exception instanceof org.springframework.dao.DataIntegrityViolationException)
+	    {
+		code = PersistenceException.PersistenceCode.INTEGRITY_VIOLATION;
+	    }
+	    else if (exception instanceof org.springframework.dao.DataRetrievalFailureException)
+	    {
+		code = PersistenceException.PersistenceCode.RETRIEVAL_FAILURE;
+	    }
+	    else if (exception instanceof org.springframework.jdbc.datasource.lookup.DataSourceLookupFailureException)
+	    {
+		code = PersistenceException.PersistenceCode.DATA_SOURCE_LOOKUP_FAILURE;
+	    }
+	    else if (exception instanceof org.springframework.dao.InvalidDataAccessApiUsageException)
+	    {
+		code = PersistenceException.PersistenceCode.INVALID_API_USAGE;
+	    }
+	    else if (exception instanceof org.springframework.dao.PermissionDeniedDataAccessException)
+	    {
+		code = PersistenceException.PersistenceCode.PERMISSION_DENIED;
+	    }
+	    else
+	    {
+		code = PersistenceException.PersistenceCode.UNKNOWN_FAILURE;
+	    }
+	}
+	else
+	{
+	    code = PersistenceException.PersistenceCode.UNKNOWN_FAILURE;
+	}
+
+	final StringBuilder message = new StringBuilder();
+	message.append(exception.getMessage());
+
+	final Throwable cause = exception.getCause();
+	if (null != cause)
+	{
+	    message.append(" : ").append(cause.getMessage());
+	}
+
+	return new PersistenceException(code, message.toString(),
+		exception);
+    }
+
+    private static final Log LOGGER = LogFactory.getLog(PersistenceUtils.class);
+}
Index: /ether_ndacc/trunk/persistence/interface/com/ether/dao/DomainAccessObject.java
===================================================================
--- /ether_ndacc/trunk/persistence/interface/com/ether/dao/DomainAccessObject.java	(revision 105)
+++ /ether_ndacc/trunk/persistence/interface/com/ether/dao/DomainAccessObject.java	(revision 105)
@@ -0,0 +1,179 @@
+package com.ether.dao;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.criterion.DetachedCriteria;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import com.ether.PersistenceException;
+
+public interface DomainAccessObject<DO, PK extends Serializable>
+{
+    /**
+     * @return the domain object class.
+     */
+    Class<DO> getDomainObjectClass();
+
+    /**
+     * Selects an object by criteria.
+     * The result of the select can be an object or any other types in case of projection or a transformed result.
+     *
+     * @param criteria the criteria.
+     * @return the first persistent object that match the criteria.
+     */
+    @Nullable
+    DO selectByCriteria( DetachedCriteria criteria )
+            throws PersistenceException;
+
+    /**
+     * Selects an object by criteria.
+     * The result of the select can be an object or any other types in case of projection or a transformed result.
+     *
+     * @param objectClass the object class.
+     * @param criteria    the criteria.
+     * @return the first persistent object that match the criteria.
+     */
+    @Nullable
+    <O> O selectByCriteria( Class<O> objectClass, DetachedCriteria criteria )
+            throws PersistenceException;
+    
+    /**
+     * Selects by criteria. The criteria must created for the object class.
+     * The result of the select can contain an object list or any other types in case of projection or a transformed result.
+     *
+     * @param criteria the criterions.
+     * @return all persistent objects that match the criteria.
+     */
+    @NotNull
+    List<DO> selectAllByCriteria( DetachedCriteria criteria )
+            throws PersistenceException;
+
+    /**
+     * Selects by criteria. The criteria must created for the object class.
+     * The result of the select can contain an object list or any other types in case of projection or a transformed result.
+     *
+     * @param objectClass the object class.
+     * @param criteria    the criterions.
+     * @return all persistent objects that match the criteria.
+     */
+    @NotNull
+    <O> List<O> selectAllByCriteria( Class<O> objectClass, DetachedCriteria criteria )
+            throws PersistenceException;
+    
+    /**
+     * Retrieves a domain object that was previously persisted to the database using
+     * the specified primary key.
+     *
+     * @param primaryKey the primary key.
+     * @return the persistent object with the specified primary key. <code>null</code> if not found
+     */
+    @Nullable
+    DO selectByPrimaryKey( @NotNull final PK primaryKey )
+            throws PersistenceException;
+
+    /**
+     * Retrieves a domain object by example.
+     *
+     * @param domainObject the example domain object.
+     * @return a domain object by example.
+     */
+    DO selectByExample( final DO domainObject )
+            throws PersistenceException;
+
+    /**
+     * Retrieves a domain object by example.
+     *
+     * @param domainObject the example domain object.
+     * @return a domain object by example.
+     */
+    List<DO> selectAllByExample( final DO domainObject )
+            throws PersistenceException;
+    
+    /**
+     * Returns all persistent objects of type.
+     *
+     * @return all persistent objects of type.
+     * @throws PersistenceException the persistence exception.
+     */
+    List<DO> selectAll()
+            throws PersistenceException;
+    
+    /**
+     * Persists a domain object into database and return the object primary key.
+     *
+     * @param domainObject a domain object.
+     * @return the primary key.
+     */
+    @NotNull
+    PK insert( final DO domainObject )
+            throws PersistenceException;
+
+    void insertAll( @NotNull final Collection<DO> domainObjects )
+            throws PersistenceException;
+
+    /**
+     * Updates persistent object with domain object changes.
+     *
+     * @param domainObject a domain object.
+     */
+    void update( final DO domainObject )
+            throws PersistenceException;
+
+    /**
+     * Updates persistent objects with domain objects changes.
+     *
+     * @param domainObjects domain objects to update.
+     */
+    void updateAll( final Collection<? extends DO> domainObjects )
+            throws PersistenceException;
+
+    /**
+     * Upgrades domain object with persistent objects changes.
+     *
+     * @param domainObject the domain object.
+     */
+    void upgrade( final DO domainObject )
+            throws PersistenceException;
+
+    /**
+     * Upgrades domain objects with persistent objects changes.
+     *
+     * @param domainObjects the domain object.
+     */
+    void upgradeAll( final Collection<DO> domainObjects )
+            throws PersistenceException;
+
+    /**
+     * Deletes the primary key.
+     *
+     * @param primaryKey the primary key.
+     */
+    void deleteByPrimaryKey( final PK primaryKey )
+            throws PersistenceException;
+
+    /**
+     * Deletes an object from persistent storage in the database.
+     *
+     * @param domainObject the domain object.
+     */
+    void delete( final DO domainObject )
+            throws PersistenceException;
+
+    /**
+     * Deletes all domain objects in the database.
+     *
+     * @param domainObjects the domain objects to delete.
+     */
+    void deleteAll( final Collection<DO> domainObjects )
+            throws PersistenceException;
+
+     /**
+     * Sets the session factory.
+     * @param sessionFactory the session factory.
+     */
+    void setSessionFactory( SessionFactory sessionFactory );
+}
Index: /ether_ndacc/trunk/persistence/interface/com/ether/dao/instrument/InstrumentDAO.java
===================================================================
--- /ether_ndacc/trunk/persistence/interface/com/ether/dao/instrument/InstrumentDAO.java	(revision 105)
+++ /ether_ndacc/trunk/persistence/interface/com/ether/dao/instrument/InstrumentDAO.java	(revision 105)
@@ -0,0 +1,28 @@
+package com.ether.dao.instrument;
+
+import java.util.List;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import com.ether.PersistenceException;
+import com.ether.dao.DomainAccessObject;
+import com.ether.instrument.Instrument;
+import com.ether.instrument.InstrumentType;
+
+/**
+ * @author vmipsl
+ * @date 24 jan 2011
+ */
+public interface InstrumentDAO 
+	extends DomainAccessObject<Instrument, Long>
+{
+    @NotNull
+    Integer getNbInstruments() throws PersistenceException;
+    
+    @Nullable 
+    List<Instrument> getInstrumentsByStationId(@NotNull final Long stationId) throws PersistenceException;    
+
+    @Nullable 
+    List<Instrument> getInstrumentsByType(@NotNull final InstrumentType type) throws PersistenceException;    
+}
Index: /ether_ndacc/trunk/persistence/interface/com/ether/dao/plot/PlotDAO.java
===================================================================
--- /ether_ndacc/trunk/persistence/interface/com/ether/dao/plot/PlotDAO.java	(revision 105)
+++ /ether_ndacc/trunk/persistence/interface/com/ether/dao/plot/PlotDAO.java	(revision 105)
@@ -0,0 +1,24 @@
+package com.ether.dao.plot;
+
+import java.util.Date;
+import java.util.List;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import com.ether.PersistenceException;
+
+public interface PlotDAO {
+	
+	@Nullable
+	public List<Date> getListeDistinctDates() throws PersistenceException;
+	@Nullable
+	public List<Date> getDatesByInstrument(@NotNull final String instrument) throws PersistenceException;
+	@Nullable
+	public Date getLastDateByInstrumentByStation(@NotNull final String instrument,@NotNull final String station) throws PersistenceException;
+	
+	@Nullable
+	public List<String> getPlotsByDateByInstrument(@NotNull final String instrument, @NotNull final Date pFormatDate_deb, @NotNull final Date pFormatDate_fin) throws PersistenceException;
+	@Nullable
+	public List<String> getPlotsByDateByInstrumentByStation(@NotNull final String instrument, @NotNull final Date pFormatDate_deb, @NotNull final Date pFormatDate_fin, @NotNull final String station) throws PersistenceException;
+}
Index: /ether_ndacc/trunk/persistence/interface/com/ether/dao/station/StationDAO.java
===================================================================
--- /ether_ndacc/trunk/persistence/interface/com/ether/dao/station/StationDAO.java	(revision 105)
+++ /ether_ndacc/trunk/persistence/interface/com/ether/dao/station/StationDAO.java	(revision 105)
@@ -0,0 +1,26 @@
+package com.ether.dao.station;
+
+import java.util.List;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import com.ether.PersistenceException;
+import com.ether.dao.DomainAccessObject;
+import com.ether.station.Station;
+
+/**
+ * @author vmipsl
+ * @date 24 jan 2011
+ */
+public interface StationDAO extends DomainAccessObject<Station, Long>
+{
+    @NotNull
+    Integer getNbStations() throws PersistenceException;
+    
+    @Nullable 
+    List<Station> getStationsByAltitude(@NotNull final String altitude) throws PersistenceException;
+    
+    @Nullable
+    Station getStationByName(@NotNull final String stationName) throws PersistenceException;  
+}
Index: /ether_ndacc/trunk/persistence/sql/create.sql
===================================================================
--- /ether_ndacc/trunk/persistence/sql/create.sql	(revision 105)
+++ /ether_ndacc/trunk/persistence/sql/create.sql	(revision 105)
@@ -0,0 +1,46 @@
+CREATE SEQUENCE S_TABLE_TEST
+
+/*==============================================================*/
+/* Table : TABLE_TEST                                      */
+/*==============================================================*/
+CREATE TABLE TABLE_TEST  (
+   TABLE_TEST_ID        NUMBER(9,0)                     NOT NULL,
+   CODE                 NVARCHAR2(50)                   NOT NULL,
+   VALUE                INTEGER,
+   IS_VISIBLE           NUMBER(1,0)                    DEFAULT 0 NOT NULL
+      CONSTRAINT CKC_IS_VISIBLE_TABLE_TEST CHECK (IS_VISIBLE IN (0,1)),
+   DEFAULT_TRANSLATION  NVARCHAR2(255),
+   CONSTRAINT PK_TABLE_TEST PRIMARY KEY (TABLE_TEST_ID),
+   CONSTRAINT AK_TABLE_TEST_CO_ACH_ACHI UNIQUE (CODE)
+)
+/* GO */
+
+
+COMMENT ON TABLE TABLE_TEST IS
+'Table de test'
+/* GO */
+
+
+COMMENT ON COLUMN TABLE_TEST.TABLE_TEST_ID IS
+'The identifier of the element'
+/* GO */
+
+
+COMMENT ON COLUMN TABLE_TEST.CODE IS
+'The element code'
+/* GO */
+
+
+COMMENT ON COLUMN TABLE_TEST.VALUE IS
+'The element value'
+/* GO */
+
+
+COMMENT ON COLUMN TABLE_TEST.IS_VISIBLE IS
+'Test for a boolean'
+/* GO */
+
+
+COMMENT ON COLUMN TABLE_TEST.DEFAULT_TRANSLATION IS
+'The default translation of the element'
+/* GO */
Index: /ether_ndacc/trunk/persistence/sql/createPostGresql.sql
===================================================================
--- /ether_ndacc/trunk/persistence/sql/createPostGresql.sql	(revision 105)
+++ /ether_ndacc/trunk/persistence/sql/createPostGresql.sql	(revision 105)
@@ -0,0 +1,33 @@
+/*=============================================================*/
+/*== http://www.postgresql.org/docs/8.1/static/datatype.html ==*/
+/*=============================================================*/
+
+CREATE SEQUENCE S_TABLE_TEST;
+
+/*=============================================================*/
+/* Table : TABLE_TEST                                          */
+/*=============================================================*/
+CREATE TABLE TABLE_TEST  (
+   TABLE_TEST_ID        NUMERIC                     NOT NULL,
+   CODE                 VARCHAR(50)                 NOT NULL,
+   VALUE                INTEGER,
+   IS_VISIBLE           BOOLEAN                     DEFAULT FALSE NOT NULL,
+   DEFAULT_TRANSLATION  VARCHAR(255),
+   CONSTRAINT PK_TABLE_TEST PRIMARY KEY (TABLE_TEST_ID),
+   CONSTRAINT AK_TABLE_TEST_CO_ACH_ACHI UNIQUE (CODE)
+);
+
+COMMENT ON TABLE TABLE_TEST IS 'Table de test';
+COMMENT ON COLUMN TABLE_TEST.TABLE_TEST_ID IS 'The identifier of the element';
+COMMENT ON COLUMN TABLE_TEST.CODE IS 'The element code';
+COMMENT ON COLUMN TABLE_TEST.VALUE IS 'The element value';
+COMMENT ON COLUMN TABLE_TEST.IS_VISIBLE IS 'Test for a boolean';
+COMMENT ON COLUMN TABLE_TEST.DEFAULT_TRANSLATION IS 'The default translation of the element';
+
+
+/*=============================================================*/
+/* INSERTS                                                     */
+/*=============================================================*/
+INSERT INTO table_test VALUES (nextval('S_TABLE_TEST'),'code_test_1','6548','FALSE','code test translation 1');
+INSERT INTO table_test VALUES (nextval('S_TABLE_TEST'),'code_test_2','789','TRUE','code test translation 2');
+INSERT INTO table_test VALUES (nextval('S_TABLE_TEST'),'code_test_3','1234','FALSE','code test translation 3');
Index: /ether_ndacc/trunk/persistence/test/com/ether/HibernateTestUtils.java
===================================================================
--- /ether_ndacc/trunk/persistence/test/com/ether/HibernateTestUtils.java	(revision 105)
+++ /ether_ndacc/trunk/persistence/test/com/ether/HibernateTestUtils.java	(revision 105)
@@ -0,0 +1,91 @@
+package com.ether;
+
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.springframework.orm.hibernate3.HibernateCallback;
+import org.springframework.orm.hibernate3.HibernateTemplate;
+import org.springframework.transaction.annotation.Transactional;
+
+public abstract class HibernateTestUtils<BEAN>
+        extends TestUtils<BEAN>
+{
+    /**
+     * The constructor.
+     *
+     * @param beanContextName        the bean context name.
+     * @param beanName               the bean name.
+     * @param otherContextNames      the other context names.
+     * @param sessionFactoryBeanName the session factory bean name.
+     */
+    protected HibernateTestUtils( final String beanContextName, final String beanName, final String[] otherContextNames, final String sessionFactoryBeanName )
+    {
+        super( beanContextName, beanName, otherContextNames );
+        _sessionFactoryBeanName = sessionFactoryBeanName;
+    }
+
+    /**
+     * Executes operations before running test.
+     * Implemented in ServiceTestUtils class
+     */
+    protected abstract void beforeHibernateTest()
+            throws Exception;
+
+    /**
+     * Executes operations after running test.
+     * Implemented in ServiceTestUtils class 
+     */
+    protected abstract void afterHibernateTest()
+            throws Exception;
+
+    @Override
+    protected final void beforeBeanTest()
+            throws Exception
+    {
+        final SessionFactory sessionFactory;
+
+        if( _sessionFactoryBeanName != null )
+            sessionFactory = (SessionFactory) getApplicationContext().getBean( _sessionFactoryBeanName );
+        else
+            sessionFactory = (SessionFactory) getApplicationContext().getBean( DEFAULT_SESSION_FACTORY_BEAN_NAME );
+
+        _hibernateTemplate = new HibernateTemplate( sessionFactory );
+        beforeHibernateTest();
+    }
+
+    @Override
+    protected final void afterBeanTest()
+            throws Exception
+    {
+        afterHibernateTest();        
+        _hibernateTemplate = null;
+    }
+
+    /**
+     * Delete all datas.
+     *
+     * @param persistentObjectClasses the persistent object classes.
+     * @throws Exception an exception.
+     */
+    @Transactional
+    protected final void deleteAllDatas( final Class<?>[] persistentObjectClasses )
+            throws Exception
+    {
+        _hibernateTemplate.execute( new HibernateCallback()
+        {
+            public Object doInHibernate( final Session session )
+                    throws HibernateException
+            {
+                for( final Class<?> persistentObjectClass : persistentObjectClasses )
+                    session.createQuery( "delete from " + persistentObjectClass.getName() ).executeUpdate();
+
+                return null;
+            }
+        } );
+    }
+
+    private static final String DEFAULT_SESSION_FACTORY_BEAN_NAME = "sessionFactory";
+    
+    private String _sessionFactoryBeanName;
+    private HibernateTemplate _hibernateTemplate;
+}
