Announcement Announcement Module
Collapse
No announcement yet.
T save (T entity) - Method from CrudRepository does not save the in OSGi context Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • T save (T entity) - Method from CrudRepository does not save the in OSGi context

    Hi,
    I have a base interface for all my jpa repositories. Please take a look at my previous post on this topic to understand my actual problem.

    http://http://forum.springsource.org/showthread.php?120460-1-4-2-Adding-custom-behaviour-to-all-repositories-%28Reference-doc%29-not-up-to-date

    The implementation of the base interface overrides the save-method of the CRUD-Repository. Everything works well when I run unit tests. Entities are saved. But when my module is deployed in an OSGi context, the same save-method is executed, an ID is successfully generated but entities are not saved and no exception is thrown.

    here is my save-method
    Code:
    	
    @Override
    public T save(T entity) {
         T internalEntity = translate(entity);
         return super.save(internalEntity); // save Method of SimpleJpaRepository
    }
    and the save()-Method of SimpleJpaRepoisitory
    Code:
    	
    @Transactional
    public T save(T entity) {
    
    	if (entityInformation.isNew(entity)) {
    		em.persist(entity);
    		return entity;
    	} else {
    		return em.merge(entity);
    	}
    }

    I don't understand why the entity is not saved and why there's no exception thrown?
    Is the @Transactional annotation ignored?

    Thank you for any help.

    Alioum
Working...
X