Bonjour à tous,
J'utilise hibernate dans un projet EAR avec différentes EJB. Mon serveur d'application est glassfish v3.
Mon fichier de configuration hibernate correspond à :
Dans mon WS, je déclare :
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 <?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> <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property> <property name="hibernate.default_schema">public</property> <property name="hibernate.connection.driver_class">org.postgresql.Driver</property> <property name="hibernate.show_sql">false</property> <property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/database</property> <property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property> <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.SunONETransactionManagerLookup</property> <mapping resource=""/> [...] </session-factory> </hibernate-configuration>
Rien n'est commit en base, je ne comprends pas pourquoi. Je n'ai pas de message d'erreur dans glassfish. Il me semblait qu'avec org.hibernate.transaction.CMTTransactionFactory, il n'y avait pas besoin de commit.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 @WebService(name = "RegistrationWS", serviceName = "RegistrationWS", portName = "RegistrationPort") @Stateless() public class RegistrationWS implements IRegistrationWS { @Override public String addSociety() throws YousignException { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); object=new Object(); session.save(object); } }
Merci pour votre aide !
Partager