【发布时间】:2015-10-30 10:34:37
【问题描述】:
我们已经这样设置了 Spring 框架:
@Eager
public interface CatalogElementRepository extends PagingAndSortingRepository<CatalogElementEntity, Long> {
}
@Service
public class CatalogImpl implements CatalogManager {
@Inject
CatalogElementRepository catalogElementRepository;
@Override
public CatalogElement createCatalogElement(CatalogElementEntity catalogElement) {
return this.catalogElementRepository.save(catalogElement);
}
}
@Stateless
@Remote(CatalogManager.class)
public class CatalogManagerBean implements CatalogManager {
@Inject
CatalogManager delegate;
@Override
public CatalogElement createCatalogElement(CatalogElementEntity catalogElement) {
return this.delegate.createCatalogElement(catalogElement);
}
}
因此,每当有人调用远程接口createCatalogElement 上的方法时,我都会假设实体已存储在数据库中。它没有(奇怪的是,findOne 仍然返回相同的实体,但无法通过findByProperty 找到它)。
Otherquestions 说要添加@Transactional,所以为了安全起见,我在方法和类上添加了@javax.transaction.Transactional 和org.springframework.transaction.annotation.Transactional,没有任何效果。
可能是什么问题?
我没有看到 Spring Framework 的任何配置文件,但它是一个遗留项目,所以它们可能被隐藏得很好。
【问题讨论】:
标签: java spring jpa spring-data-jpa