public class Person implements Serializable
{
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column(name = "id")
  private long id;

  @OneToMany(targetEntity=PersonHouse.class , mappedBy="person" ,
 cascade=CascadeType.ALL , fetch=FetchType.LAZY )
  @MapKey(name="house")
  private Map<String , PersonHouse> houseMap;
}

public class PersonHouse implements Serializable
{
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column(name = "id")
  private long    id;

  @ManyToOne
  @JoinColumn(name="personId" , insertable=false , updatable=false)
  private Person person;
}

The simple @OneToMany bi-directional Map works fine in Hibernate , but has
such error with Amber :

com.caucho.amber.AmberRuntimeException: java.lang.NoSuchMethodException:
foo.PersonHouse.this.__caucho_super_get_id()()
      at
com.caucho.amber.AmberRuntimeException.create(AmberRuntimeException.java:70)
      at foo.Person.__caucho_get_houseMap(Person.java)
      at foo.Person.getHouseMap(Person.java:232)
      at foo.HelloServlet.doGet(HelloServlet.java:46)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:119)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:96)
      at
com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109)
      at
com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:183)
      at
com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:103)
      at
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:286)
      at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:780)
      at
com.caucho.server.connection.TcpConnection.dispatchRequest(TcpConnection.java:600)
      at
com.caucho.server.connection.TcpConnection.handleRequestsImpl(TcpConnection.java:566)
      at
com.caucho.server.connection.TcpConnection.handleRequests(TcpConnection.java:519)
      at
com.caucho.server.connection.TcpConnection$AcceptTask.doTask(TcpConnection.java:1100)
      at
com.caucho.server.connection.TcpConnection$ConnectionReadTask.runThread(TcpConnection.java:1037)
      at
com.caucho.server.connection.TcpConnection$AcceptTask.run(TcpConnection.java:1068)
      at com.caucho.util.ThreadPool$PoolThread.runTasks(ThreadPool.java:901)
      at com.caucho.util.ThreadPool$PoolThread.run(ThreadPool.java:866)
Caused by: java.lang.NoSuchMethodException:
foo.PersonHouse.this.__caucho_super_get_id()()
      at java.lang.Class.getDeclaredMethod(Class.java:1937)
      ... 18 more

BTW , targetEntity is skippable in Hibernate , but seems indispensable in
Amber .
Is it imperative in JPA spec ?

Resin 4.0.4
_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to