bonjour tout le monde , j utilise HibernateSynchronizer-3.1.9
j ai un probleme avec l ouverture de la session hibernate
ma console

at model.dao._BaseRootDAO.closeSession(_BaseRootDAO.java:191)
at model.dao._BaseRootDAO.findAll(_BaseRootDAO.java:243)
at TransfertAtlantiqueServicePersistance.findAll(TransfertAtlantiqueServicePersistance.java:30)
at TransfertDeDonneesAtlantique.<init>(TransfertDeDonneesAtlantique.java:18)
at TransfertDeDonneesAtlantique.main(TransfertDeDonneesAtlantique.java:41)
donc ma configuration est null
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
package model.dao;

import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.criterion.Expression;
import org.hibernate.criterion.Order;

/**
 * This class has been automatically generated by Hibernate Synchronizer. For
 * more information or documentation, visit The Hibernate Synchronizer page at
 * http://www.binamics.com/hibernatesync or contact Joe Hudson at
 * joe@binamics.com.
 */
public abstract class _BaseRootDAO {

	protected static Map sessionFactoryMap = new HashMap();

	protected static ThreadLocal threadedSessions = new ThreadLocal();

	/**
	 * Configure the session factory by reading hibernate config file
	 */
	public static void initialize() throws HibernateException {
		initialize((String) null);
	}

	/**
	 * Configure the session factory by reading hibernate config file
	 * 
	 * @param configFileName
	 *            the name of the configuration file
	 */
	public static void initialize(String configFileName)
			throws HibernateException {
		if (null == configFileName && sessionFactoryMap.size() > 0)
			return;
		else if (null != sessionFactoryMap.get(configFileName))
			return;
		else {
			Configuration cfg = new Configuration();
			if (null == configFileName)
				cfg.configure();
			else
				cfg.configure(configFileName);
			setSessionFactory(configFileName, cfg.buildSessionFactory());
		}
	}

	/**
	 * Set the session factory
	 */
	protected static void setSessionFactory(SessionFactory sessionFactory) {
		setSessionFactory((String) null, sessionFactory);
	}

	/**
	 * Set the session factory
	 */
	protected static void setSessionFactory(String configFileName,
			SessionFactory sessionFactory) {
		sessionFactoryMap.put(configFileName, sessionFactory);
	}

	/**
	 * Return the SessionFactory that is to be used by these DAOs. Change this
	 * and implement your own strategy if you, for example, want to pull the
	 * SessionFactory from the JNDI tree.
	 */
	protected SessionFactory getSessionFactory() throws HibernateException {
		return getSessionFactory(getConfigurationFileName());
	}

	private static SessionFactory getSessionFactory(String configFile)
			throws HibernateException {
		if (sessionFactoryMap.size() == 1)
			return (SessionFactory) sessionFactoryMap.values().toArray()[0];
		else {
			SessionFactory sessionFactory = (SessionFactory) sessionFactoryMap
					.get(configFile);
			if (null == sessionFactory)
				if (null == configFile)
					throw new RuntimeException(
							"The session factory has not been initialized.");
				else
					throw new RuntimeException("The session factory for '"
							+ configFile + "' has not been initialized.");
			else
				return sessionFactory;
		}
	}

	/**
	 * Return a new Session object that must be closed when the work has been
	 * completed.
	 * 
	 * @return the active Session
	 */
	protected Session getSession() throws HibernateException {
		return createSession();
	}
	/**
	 * Return a new Session object that must be closed when the work has been
	 * completed.
	 * 
	 * @return the active Session
	 */
	public static Session createSession() throws HibernateException {
                                 //voila le probleme comment initialiser mon conf
		return createSession(null);	}

	/**
	 * Return a new Session object that must be closed when the work has been
	 * completed.
	 * 
	 * @param configFile
	 *            the config file must match the meta attribute "config-file" in
	 *            the hibernate mapping file
	 * @return the active Session
	 *///bien sur configFile est null
	public static Session createSession(String configFile)
			throws HibernateException {
		java.util.Stack sessionStack = (java.util.Stack) threadedSessions.get();
		Session session = null;
		if (null == sessionStack) {
			sessionStack = new java.util.Stack();
			threadedSessions.set(sessionStack);
		}
		if (sessionStack.size() > 0) {
			Object[] arr = (Object[]) sessionStack.peek();
			String cf = (String) arr[0];
			if (null == cf) {
				session = (Session) arr[1];
			} else if (null != cf && null != configFile) {
				if (cf.equals(configFile))
					session = (Session) arr[1];
			}
			if (null == session) {
				session = getSessionFactory(configFile).openSession();
				arr = new Object[2];
				arr[0] = configFile;
				arr[1] = session;
				sessionStack.push(arr);
			}
		} else {
			session = getSessionFactory(configFile).openSession();
			Object[] arr = new Object[2];
			arr = new Object[2];
			arr[0] = configFile;
			arr[1] = session;
			sessionStack.push(arr);
		}
		return session;
	}

	/**
	 * Return the name of the configuration file to be used with this DAO or
	 * null if default
	 */
	public String getConfigurationFileName() {
		return null;
	}

	/**
	 * Return the specific Object class that will be used for class-specific
	 * implementation of this DAO.
	 * 
	 * @return the reference Class
	 */
	protected abstract Class getReferenceClass();

	/**
	 * Close the session
	 */
	public void closeSession() throws HibernateException {
		java.util.Stack sessionStack = (java.util.Stack) threadedSessions.get();
		if (null != sessionStack) {
			Object[] arr = (Object[]) sessionStack.peek();
			String cf = (String) arr[0];
			if (null == cf) {
				Session session = (Session) arr[1];
				session.close();
				sessionStack.pop();
			} else {
				String configurationFile = getConfigurationFileName();
				if (null != configurationFile && configurationFile.equals(cf)) {
					Session session = (Session) arr[1];
					session.close();
					sessionStack.pop();
				}
			}
		}
	}

	/**
	 * Execute a query.
	 * 
	 * @param query
	 *            a query expressed in Hibernate's query language
	 * @return a distinct list of instances (or arrays of instances)
	 */
	/*
	 * public java.util.List find(String query) throws HibernateException {
	 * Session s = null; try { s = getSession(); return find(query, s); }
	 * finally { closeSession(); } }
	 */

	/**
	 * Perform a find but use the session given instead of creating a new one.
	 * 
	 * @param query
	 *            a query expressed in Hibernate's query language
	 * @s the Session to use
	 */
	/*
	 * public java.util.List find(String query, Session s) throws
	 * HibernateException { return s.find(query); }
	 */

	/**
	 * Return all objects related to the implementation of this DAO with no
	 * filter.
	 */
	public java.util.List findAll() throws HibernateException {
		Session s = null;
		try {
			s = getSession();
			return findAll(s);
		} finally {
			closeSession();
		}
	}
	
}
comme plusieurs ont pu le remarque. C est le code généré par
HibernateSynchronizer.
Alors comment faire appel a mon configuration que je pense est mon hibernate.cfg.xml merci d avance