Bonjour,

je dois mettre à jour une application JEE Spring (2.0) Hibernate (3.13) struts (1.3.10).

j'ai donc crée une nouvelle table "configuration", le mappring, la DAO, Le SERVICE .

Lorsque je tente d'acceder à ma table voici ce que je me prends ( la première ligne indique que la requête précédente est passée):
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
 
Hibernate: select this_.id as id19_2_, this_.optimist_lock as optimist2_19_2_, this_.id_variante as id3_19_2_, this_.nom as nom19_2_, this_.serial_number as serial5_19_2_, this_.hc_number as hc6_19_2_, this_.registration as registra7_19_2_, this_.rank as rank19_2_, this_.hour_shift as hour9_19_2_, this_.date_fpo_prev as date10_19_2_, this_.date_fpo_eff as date11_19_2_, this_.date_po_prev as date12_19_2_, this_.date_po_eff as date13_19_2_, this_.date_fi_prev as date14_19_2_, this_.date_fi_eff as date15_19_2_, this_.date_flt_prev as date16_19_2_, this_.date_flt_eff as date17_19_2_, this_.date_delivery_prev as date18_19_2_, this_.date_delivery_eff as date19_19_2_, this_.date_eobt_prev as date20_19_2_, this_.date_eobt_eff as date21_19_2_, this_.date_1gr_prev as date22_19_2_, this_.date_1gr_eff as date23_19_2_, this_.date_1flight_prev as date24_19_2_, this_.date_1flight_eff as date25_19_2_, this_.date_vso_prev as date26_19_2_, this_.date_vso_eff as date27_19_2_, this_.regression_coefficient as regression28_19_2_, this_.more_info as more29_19_2_, this_.phase as phase19_2_, this_.on_gts_index as on31_19_2_, this_.remarque as remarque19_2_, this_.auto_validation as auto33_19_2_, this_.tn_doc as tn34_19_2_, this_.quality_gate_2b as quality35_19_2_, this_.status_qg as status36_19_2_, this_.curve as curve19_2_, this_.progress as progress19_2_, this_.fl_pf1 as fl39_19_2_, this_.fl_pfs as fl40_19_2_, this_.fl_t1 as fl41_19_2_, this_.fl_t2 as fl42_19_2_, this_.fl_t3 as fl43_19_2_, this_.fl_tsystem as fl44_19_2_, this_.numero_derogation as numero45_19_2_, this_.id_assembly_line as id46_19_2_, this_.id_batch as id47_19_2_, variante2_.id as id71_0_, variante2_.optimist_lock as optimist2_71_0_, variante2_.nom as nom71_0_, variante2_.type as type71_0_, variante2_.drapeau as drapeau71_0_, variante2_.submitted as submitted71_0_, variante2_.fal as fal71_0_, variante2_.rank as rank71_0_, al1_.id as id5_1_, al1_.optimist_lock as optimist2_5_1_, al1_.libelle as libelle5_1_, al1_.ts_responsible as ts4_5_1_, al1_.ts_first_letter as ts5_5_1_, al1_.ts_second_letter as ts6_5_1_ from helico this_ inner join variante variante2_ on this_.id_variante=variante2_.id inner join assembly_line al1_ on this_.id_assembly_line=al1_.id where al1_.id=? and this_.phase=?
ERROR FwkExceptionHandler.execute():  - java.lang.IllegalStateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
	at org.springframework.orm.hibernate3.SessionFactoryUtils.doGetSession(SessionFactoryUtils.java:357)
	at org.springframework.orm.hibernate3.SessionFactoryUtils.getSession(SessionFactoryUtils.java:189)
Voici le Code Utilisé je met celui d'une table qui fonctionne et celui de ma nouvelle table.

Struts DAO config :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
<bean id="TimeDaoImpl" class="corp.xxx.gtg.dao.TimeDaoImpl" parent="baseDaoImpl"/>
	<bean id="TimeDao" parent="baseDao"><property name="target"><ref local="TimeDaoImpl"/></property></bean>
 
<bean id="ConfigurationDaoImpl" class="corp.xxx.gtg.dao.ConfigurationDaoImpl" parent="baseDaoImpl"/>
	<bean id="ConfigurationDao" parent="baseDao"><property name="target"><ref local="ConfigurationDaoImpl"/></property></bean>
Struts Service config :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
	<bean id="TimeServiceImpl" class="corp.xxx.gtg.service.TimeServiceImpl" parent="baseServiceImpl">
		<property name="timeDao"><ref bean="TimeDaoImpl" /></property>
	</bean>
	<bean id="TimeService" parent="baseService"><property name="target"><ref local="TimeServiceImpl"/></property></bean>
		<bean id="ConfigurationServiceImpl" class="corp.xxx.gtg.service.ConfigurationServiceImpl" parent="baseServiceImpl">
		<property name="configurationDao"><ref bean="ConfigurationDaoImpl" /></property>
	</bean>
	<bean id="ConfigurationService" parent="baseService"><property name="target"><ref local="ConfigurationServiceImpl"/></property></bean>
le spring config sgbd :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
	<!-- Intercepteur hibernate charge du remplissage des champs techniques -->
	<bean id="interceptor" class="corp.xxx.gtg.fwk.business.hibernate.FwkTechnicalFieldsInterceptor"/>
 
  	<!--**************************************************-->
	<!-- Hibernate SessionFactory  -->
	<!--**************************************************-->
	<bean id="sessionFactory"
		class="corp.xxx.gtg.fwk.business.spring.sessionfactory.DirectorySessionFactory">
		<property name="dataSource">
			<ref bean="dataSourceJndi" />
		</property>
		<property name="entityInterceptor">
			<ref local="interceptor"/>
		</property>
 
		<property name="mappingLocations">
	    	<list>
	    		<value>classpath*:**/*.hbm.xml</value>
	    	</list>
	    </property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.cglib.use_reflection_optimizer">false</prop>
				<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
				<prop key="hibernate.query.substitutions">true 1, false 0, yes 'Y', no 'N'</prop>
				<prop key="hibernate.connection.isolation">2</prop>
				<prop key="hibernate.max_fetch_depth">1</prop>
				<prop key="hibernate.show_sql">true</prop>
			</props>
		</property>
	</bean>
 
	<bean id="dataSourceJndi" class="org.springframework.jndi.JndiObjectFactoryBean" >
		<property name="jndiName">
			<value>java:comp/env/HeadingData</value>
		</property>
	</bean>
et le spring config business :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
   <!--**************************************************-->
   <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
   <!--**************************************************-->
   <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory">
         <ref bean="sessionFactory" />
      </property>
   </bean>
 
   <!--**************************************************-->
   <bean id="matchTxAttributes" class="corp.xxx.gtg.fwk.business.spring.transaction.NameUNMatchTxAttributeSource">
      <property name="match">
         <props>
			<prop key="delete*">PROPAGATION_REQUIRED ,-Throwable</prop>
			<prop key="save*">PROPAGATION_REQUIRED ,-Throwable</prop>
			<prop key="update*">PROPAGATION_REQUIRED ,-Throwable</prop>
			<prop key="insert*">PROPAGATION_REQUIRED ,-Throwable</prop>
			<prop key="replace*">PROPAGATION_REQUIRED ,-Throwable</prop>
			<prop key="add*">PROPAGATION_REQUIRED ,-Throwable</prop>
			<prop key="*">PROPAGATION_SUPPORTS,-readOnly,-Throwable</prop>
         </props>
      </property>
      <property name="unMatch">
         <list>
            <value>get*</value>
            <value>set*</value>
         </list>
      </property>
   </bean>
   <!--**************************************************-->
   <bean id="myTransactionInterceptor"
      class="corp.xxx.gtg.fwk.business.spring.transaction.FwkTransactionInterceptor">
      <property name="transactionManager">
         <ref bean="transactionManager" />
      </property>
      <property name="transactionAttributeSource">
         <ref bean="matchTxAttributes" />
      </property>
   </bean>
	<!--**************************************************-->
	<bean id="baseDaoImpl" class="corp.xxx.gtg.fwk.business.hibernate.HibernateDaoOrServiceImpl">
		<property name="sessionFactory">
			<ref bean="sessionFactory"/>
		</property>
	</bean>
	<bean id="baseDao" class="org.springframework.aop.framework.ProxyFactoryBean">
      <property name="target"><ref local="baseDaoImpl"/></property>
      <property name="interceptorNames">
         <list>
            <value>myTransactionInterceptor</value>
         </list>
      </property>
	</bean>
	<bean id="baseServiceImpl" class="corp.xxx.gtg.fwk.business.hibernate.HibernateDaoOrServiceImpl">
		<property name="sessionFactory">
			<ref bean="sessionFactory"/>
		</property>
	</bean>
	<bean id="baseService" class="org.springframework.aop.framework.ProxyFactoryBean">
      <property name="target"><ref local="baseServiceImpl"/></property>
      <property name="interceptorNames">
         <list>
            <value>myTransactionInterceptor</value>
         </list>
      </property>
	</bean>
le mappings de la table time :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<hibernate-mapping>
    <meta attribute="extends">corp.xxx.gtg.fwk.business.model.AbstractHb</meta>
	    <class name="corp.xxx.gtg.hb.HbTime" table="time">
	    <id name="id" type="java.lang.Long">
	            <column name="id" scale="0" />
				<generator class="native"/>
	    </id>
        <version name="optimistLock" type="long">
            <column name="optimist_lock" scale="0" not-null="true" />
        </version>
        <property name="idTsTask" type="java.lang.Long">
            <column name="id_ts_task" scale="0" not-null="true"/>
        </property>
        <property name="nature" type="java.lang.Long">
            <column name="nature" scale="0" not-null="true"/>
        </property>
        <property name="idNature" type="java.lang.Long">
            <column name="id_nature" scale="0"/>
        </property>
       <property name="idFamille" type="java.lang.Long">
            <column name="id_famille" scale="0"/>
        </property>
		<property name="begin" type="timestamp">
            <column name="date_begin" not-null="true"/>
        </property>
		<property name="end" type="timestamp">
            <column name="date_end" not-null="false"/>
        </property>
		<property name="duration" type="java.lang.Long">
            <column name="duration" not-null="false"/>
        </property>
		<many-to-one name="helico" class="corp.xxx.gtg.hb.HbHelico" fetch="select" >
            <column name="id_helico" scale="0"/>
        </many-to-one>
		<many-to-one name="utilisateur" class="corp.xxx.gtg.hb.HbUtilisateur" fetch="select" >
            <column name="id_utilisateur" scale="0" />
        </many-to-one>
    </class>
</hibernate-mapping>
et le mapping de la table configuration :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<hibernate-mapping>
   <meta attribute="extends">corp.xxx.gtg.fwk.business.model.AbstractHb</meta>
    <class name="corp.xxx.gtg.hb.HbConfiguration" table="configuration">
         <id name="id" type="java.lang.Long" >
            <column name="id" scale="0"/>
            <generator class="native"/>
        </id>
        <version name="optimistLock" type="long" >
           <column name="optimist_lock" scale="0" not-null="true" />
        </version>
        <property name="mode" type="java.lang.Long" >
            <column name="mode" not-null="true" />
        </property>
        <property name="toolCsvPath" type="java.lang.String">
            <column name="toolCsvPath" not-null="true"/>
        </property>
    </class>
</hibernate-mapping>
mon Objet config :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**
 * 
 */
 
package corp.xxx.gtg.hb;
 
import corp.xxx.gtg.fwk.business.model.AbstractHb;
 
/**
 * @author
 * 
 */
public class HbConfiguration extends AbstractHb {
 
	/** Id. */
	private long	m_id;
	/** version. */
	private long	m_optimistLock;
	/** path. */
	private long	m_mode;
 
	private String	m_toolCsvPath;
 
	/**
         * default constructor.
         */
	public HbConfiguration () {
		super ();
	}
 
	/**
         * Renvoie m_id.
         * 
         * @return m_id
         */
	public Long getId () {
		return this.m_id;
	}
 
	public Long getMode () {
		return this.m_mode;
	}
 
	public long getOptimistLock () {
		return this.m_optimistLock;
	}
 
	public String getToolCsvPath () {
		return this.m_toolCsvPath;
	}
 
	/**
         * Change la valeur de m_id.
         * 
         * @param _id
         *            La nouvelle valeur
         */
	public void setId (Long _id) {
		this.m_id = _id;
	}
 
	public void setMode (Long mMode) {
		this.m_mode = mMode;
	}
 
	/**
         * Change la valeur de optimistLock.
         * 
         * @param _optimistLock
         *            La nouvelle valeur.
         */
	public void setOptimistLock (long _optimistLock) {
		this.m_optimistLock = _optimistLock;
	}
 
	public void setToolCsvPath (String mToolCsvPath) {
		this.m_toolCsvPath = mToolCsvPath;
	}
 
}
et mon objet Time (qui marche) pour comparer :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package corp.xxx.gtg.hb;
 
import java.util.Date;
 
public class HbTime extends corp.xxx.gtg.fwk.business.model.AbstractHb implements
java.io.Serializable {
 
	/**
         * For serialization 
         */
	private static final long serialVersionUID = 1L;
 
 
	/** time id */
	private Long m_id;
	/** version. */
	private long m_optimistLock;
	/** Helico */
	private HbHelico m_helico;
	/** id _ts_Task 
         * used to reference the Ts for nature = 0,2,3,4,5,6 
         * or the Task for nature 1 */
	private Long m_idTsTask;
	/** Utilisateur */
	private HbUtilisateur m_utilisateur;
	/** nature used to identify the time type
         * 0 = TS
         * 1 = Task
         * 2 = Other
         * 3 = Design Problem
         * 4 = Eqp Problem
         * 5 = Setup
         * 6 = TS Problem
         *
         */
	private Long m_nature;
	/** nature Id used to get the corresponding object 
         * for nature 0 and 5 idnature is referencing HbTsChapitreHelico object
         * for nature 1 idnature is referencing HbTask
         * for nature 2 idnature is referencing HbTroubleShooting
         * for nature 3 idnature is referencing HbSystemProblem
         * for nature 4 idnature is referencing HbQnEquipment
         * for nature 6 idnature is referencing HbTsUpdate  
         */
	private Long m_idNature;
	/** id famille 
         * only used for troubleshooting (others) or Task
         */
	private Long m_idFamille;
	/** the start date for time*/
	private Date m_begin;
	/** the end date for time*/
	private Date m_end;
	/** calculated duration between begin and end in minutes*/
	private Long m_duration;
 
 
 
 
 
 
 
 
	// Getter and Setter for class members
 
	public Date getBegin() {
		return m_begin;
	}
	public void setBegin(Date m_begin) {
		this.m_begin = m_begin;
	}
	public Long getDuration() {
		return m_duration;
	}
	public void setDuration(Long m_duration) {
		this.m_duration = m_duration;
	}
	public Date getEnd() {
		return m_end;
	}
	public void setEnd(Date m_end) {
		this.m_end = m_end;
	}
	public Long getId() {
		return m_id;
	}
	public void setId(Long m_id) {
		this.m_id = m_id;
	}
	public Long getIdFamille() {
		return m_idFamille;
	}
	public void setIdFamille(Long famille) {
		m_idFamille = famille;
	}
	public HbHelico getHelico() {
		return m_helico;
	}
	public void setHelico(HbHelico helico) {
		m_helico = helico;
	}
	public Long getIdNature() {
		return m_idNature;
	}
	public void setIdNature(Long nature) {
		m_idNature = nature;
	}
	public Long getIdTsTask() {
		return m_idTsTask;
	}
	public void setIdTsTask(Long tsTask) {
		m_idTsTask = tsTask;
	}
	public Long getNature() {
		return m_nature;
	}
	public void setNature(Long m_nature) {
		this.m_nature = m_nature;
	}
	public long getOptimistLock() {
		return m_optimistLock;
	}
	public void setOptimistLock(long lock) {
		m_optimistLock = lock;
	}
	public HbUtilisateur getUtilisateur() {
		return m_utilisateur;
	}
	public void setUtilisateur(HbUtilisateur m_utilisateur) {
		this.m_utilisateur = m_utilisateur;
	}
 
 
 
 
}

enfin la DAO :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
package corp.xxx.gtg.dao;
 
import corp.xxx.gtg.fwk.business.dao.BaseDao;
import corp.xxx.gtg.fwk.util.common.ClassUtil;
import corp.xxx.gtg.hb.HbConfiguration;
 
/**
 * @author 
 *
 */
public interface ConfigurationDao extends BaseDao {
 
 
	/** Alias. */
	String ALIAS_BEAN = ClassUtil.simpleName(ConfigurationDao.class);
 
 
	/**
         * @param id
         * @return the HbConfiguration 
         */
	HbConfiguration selectById(Long id);
}

DAO Impl :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
package corp.xxx.gtg.dao;
 
import org.hibernate.Criteria;
import org.hibernate.criterion.Expression;
 
import corp.xxx.gtg.fwk.business.dao.BaseDaoImpl;
import corp.xxx.gtg.hb.HbConfiguration;
 
/**
 * @author 
 * 
 */
public class ConfigurationDaoImpl extends BaseDaoImpl implements ConfigurationDao {
 
	public ConfigurationDaoImpl () {
		super (HbConfiguration.class);
 
	}
 
	/**
         * Description.
         * 
         * @param _id @ 
         * @return HbConfiguration
         * @see corp.xxx.gtg.dao.CategorieDao#selectById(java.lang.Long)
         */
 
 
	public HbConfiguration selectById(
			Long _id) {
		Criteria c = criteria();
		c.add(Expression.eq("id",_id));
 
		return (HbConfiguration) first(c.list());
	}
 
 
}
et le Service :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
 * 
 */
 
package corp.xxx.gtg.service;
 
import corp.xxx.gtg.fwk.business.hibernate.HibernateDaoOrService;
import corp.xxx.gtg.fwk.util.common.ClassUtil;
 
/**
 * @author 
 * 
 */
public interface ConfigurationService extends HibernateDaoOrService {
 
	/** Alias. */
	String	ALIAS_BEAN	= ClassUtil.simpleName (ConfigurationService.class);
 
 
 
	boolean getModeTiger() ;
 
 
}
Service Impl :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
package corp.xxx.gtg.service;
 
import corp.xxx.gtg.dao.ConfigurationDao;
import corp.xxx.gtg.fwk.business.hibernate.HibernateDaoOrServiceImpl;
import corp.xxx.gtg.hb.HbConfiguration;
 
public class ConfigurationServiceImpl extends HibernateDaoOrServiceImpl implements
		ConfigurationService {
 
	/** . */
	private  ConfigurationDao	m_configurationDao	= null;
 
 
	public ConfigurationDao getConfigurationDao() {
		return m_configurationDao;
	}
 
 
	public void setConfigurationDao(ConfigurationDao m_configurationDao) {
		this.m_configurationDao = m_configurationDao;
	}
 
 
	public ConfigurationServiceImpl () {
		super ();
 
	}
 
 
	public boolean getModeTiger() {
		HbConfiguration hbConf = m_configurationDao.selectById((long) 1);
 
		if (hbConf.getMode() == 1) return true;
		else return false;
 
	}
 
 
 
}

Je ne sais pas si cela vous suffit, merci d'avance de vos réponse.