cancel
Showing results for 
Search instead for 
Did you mean: 

EntityManager Injection fails with Bidirectional OneToMany

Former Member
0 Kudos

Hello,

somehow I'm not able to set up a bidirectional OneToMany relationship. I'm just getting the generic "could not inject EntityManager" exception. This is basically what i have:


class A implements AInterface {

  @OneToMany(targetEntity = B.class, mappedBy = ...)
  private Set<B> bs;
}

class B implements BInterface {

  @ManyToOne(targetEntity = A.class, optional = false)
  @JoinColumn(name = "A_ID", nullable = false)
  private A a;
}

Could someone give me some advice, please?

Konrad

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

solved...

The targetEntity annotation on ManyToOne does not work ... this is also true for OneToOne ... if you use the concrete entities it works

Edited by: konrad.krentz on Nov 17, 2009 9:39 AM

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Konrad,

Is there any particular reason that you think the problem is in the relationship definition?

Could be also in the persistence unit definition...

Can you give some more details on the application environment - persistence.xml, DataSource & alias definitions, EM injection, etc?

Best,

Yordan