Opensessioninviewfilter + HibernateTransactionManager

Galera, estou tentando implementar o pradrão Opensessioninviewfilter mais n estou conseguindo persistir os dados! faço a chamada mais ele não da o commit na session. gostaria de saber o que estou fazendo de errado… segue o código. OBG pela ajuda!!

Minha configuração do Spring

[code]<?xml version="1.0" encoding="UTF-8"?>

<context:annotation-config />

<context:component-scan
	base-package="br.com.baseProjectFilter.negocios.controladores"
	annotation-config="true" />
<context:component-scan base-package="br.com.baseProjectFilter.negocios.fachada"
	annotation-config="true" />
<context:component-scan base-package="br.com.baseProjectFilter.repositorio.DAO"
	annotation-config="true" />


<!-- Hibernate SessionFactory -->

<bean id="dataSource"
	class="org.springframework.jdbc.datasource.DriverManagerDataSource">
	<property name="driverClassName">
		<value>org.postgresql.Driver</value>
	</property>
	<property name="url">
		<value>jdbc:postgresql://localhost/base
		</value>
	</property>
	<property name="username">
		<value>postgres</value>
	</property>
	<property name="password">
		<value>123</value>
	</property>
</bean>

<bean id="sessionFactory"
	class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
	<property name="dataSource">
		<ref local="dataSource" />
	</property>
	<property name="mappingResources">
		<list>
			<value>Usuario.hbm.xml</value>
		</list>
	</property>
	<property name="hibernateProperties">
		<props>
			<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect
			</prop>
			<prop key="hibernate.show_sql">true</prop>
			<prop key="hibernate.c3p0.minPoolSize">3</prop>
			<prop key="hibernate.c3p0.maxPoolSize">20</prop>
			<prop key="hibernate.c3p0.max_statement">200</prop>
		</props>
	</property>
</bean>


<!-- transactionManager -->

<tx:annotation-driven transaction-manager="transactionManager" />

<bean id="transactionManager"
	class="org.springframework.orm.hibernate3.HibernateTransactionManager">
	<property name="sessionFactory" ref="sessionFactory" />
</bean>

<tx:advice id="txAdvice" transaction-manager="transactionManager">
	<tx:attributes>
		<tx:method name="inserir" propagation="REQUIRED" />
		<tx:method name="remover" propagation="REQUIRED" />
		<tx:method name="editar" propagation="REQUIRED" />
		<tx:method name="*" read-only="true" />
	</tx:attributes>
</tx:advice>

<aop:config>
	<aop:pointcut id="service"
		expression="execution (*
br.com.baseProjectFilter.repositorio.DAO.imp.*.* (..))" />
	<aop:advisor advice-ref="txAdvice" pointcut-ref="service" />
</aop:config>

[/code]
Meu web.xml

[code]<?xml version="1.0" encoding="ISO-8859-1"?>

<display-name>baseProjectFilter</display-name>

<!--
	There are three means to configure Wickets configuration mode and they
	are tested in the order given. 1) A system property:
	-Dwicket.configuration 2) servlet specific <init-param> 3) context
	specific <context-param> The value might be either "development"
	(reloading when templates change) or "deployment". If no configuration
	is found, "development" is the default.
-->

<listener>
	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<context-param>
	<param-name>contextConfigLocation</param-name>
	<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>


<filter>
	<filter-name>openSessionInViewFilter</filter-name>
	<filter-class>
		org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
	<init-param>
		<param-name>singleSession</param-name>
		<param-value>true</param-value>
	</init-param>
	<init-param>
		<param-name>sessionFactoryBeanName</param-name>
		<param-value>sessionFactory</param-value>
	</init-param>
</filter>

<filter-mapping>
	<filter-name>openSessionInViewFilter</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping>

<filter>
	<filter-name>wicket.baseProjectFilter</filter-name>
	<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
	<init-param>
		<param-name>applicationClassName</param-name>
		<param-value>br.com.baseProjectFilter.WicketApplication</param-value>
	</init-param>
</filter>

<filter-mapping>
	<filter-name>wicket.baseProjectFilter</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping>
[/code]

meu dao do hibernate!

[code]package br.com.baseProjectFilter.repositorio.infra;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.SessionFactoryUtils;

import br.com.baseProjectFilter.negocios.entidades.Entidade;
import br.com.baseProjectFilter.repositorio.filtro.IFiltro;

public abstract class HibernateGenericDAO<ENTIDADE extends Entidade, ID extends Serializable, FILTRO extends IFiltro>
implements IGenericDAO<ENTIDADE, ID, FILTRO> {

private Class<ENTIDADE> classe;

@Autowired
private SessionFactory sessionFactory;

public HibernateGenericDAO(Class<ENTIDADE> classe) {
	this.classe = classe;
}

@SuppressWarnings("unchecked")
public ENTIDADE buscar(final ID id) {
	return (ENTIDADE) this.getSession().get(classe, id);
}

public void editar(final ENTIDADE obj) {
	this.getSession().update(obj);
}

public List<ENTIDADE> filtrar(final FILTRO filtro) {
	// TODO Implementar HibernateGenericDAO -> filtrar
	return null;
}


public Class<ENTIDADE> getClasse() {
	return classe;
}

public Session getSession() {
	return SessionFactoryUtils.getSession(sessionFactory, false);
}

public void inserir(final ENTIDADE obj) {
	this.getSession().save(obj);
}

@SuppressWarnings("unchecked")
public List<ENTIDADE> listar() {
	return this.getSession().createQuery("FROM " + classe.getName()).list();
}

public void remover(final ENTIDADE obj) {
	this.getSession().delete(obj);
}

public void setClasse(final Class<ENTIDADE> classe) {
	this.classe = classe;
}

}
[/code]

estou quebrando a cabeça e n acho solução! agradeço a ajuda galera!!

não sei se tem alguma coisa haver mais estou usando jetty e wicket… eu preciso de alguma configuração differenciada para usar essas tecnologias ??

Acho que vc ta perguntando em lugar errado, e melhor vc postar a sua msg na área sobre persistencia.

blz… postei la!! mais vc sabe o problema :slight_smile: