[jboss-jira] [JBoss JIRA] (WFLY-3323) Transactional does not work when subclassing generic class

Marcin T (JIRA) issues at jboss.org
Wed May 7 15:26:56 EDT 2014


Marcin T created WFLY-3323:
------------------------------

             Summary: Transactional does not work when subclassing generic class
                 Key: WFLY-3323
                 URL: https://issues.jboss.org/browse/WFLY-3323
             Project: WildFly
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions: 8.1.0.CR1
            Reporter: Marcin T
            Assignee: Jason Greene


I'm getting exception: javax.persistence.TransactionRequiredException: JBAS011469: Transaction is required to perform this operation (either use a transaction or extended persistence context) for the following code:

	@Transactional
	public static class Parent<E> {

		protected EntityManager em;

		public void create(E entity) {
			em.persist(entity);
		}
	}
	
	@Transactional
	public static class Child extends Parent<EndEntity> {

		@Override
		public void create(EndEntity entity) {
			super.create(entity);
		}
	}

then I invoking create() method in submitEntity():

public class EndEntityController {

	@Inject
	private Child child;

	private Parent<EndEntity> parent() {
		return child;
	}

	protected void submitEntity(EndEntity entity) {
		EndEntity endEntity = new EndEntity();
		parent().create(endEntity);
	}

When the Parent class is not generic then the code above works.




--
This message was sent by Atlassian JIRA
(v6.2.3#6260)


More information about the jboss-jira mailing list