persistence@glassfish.java.net

RE: don't have a unique key for ID in my view

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Tue, 7 Aug 2007 10:25:28 -0400

Sud,
   You can easily create a non-entity POJO to model your view and populate that object through a constructor using a JPQL query and providing the constructor reference in the select clause. "SELECT NEW com.acme.example.CustomerDetails(c.id, c.status, o.count) FROM Customer c JOIN c.orders o WHERE o.count > 100"
 --Gordon

 -----Original Message-----
From: Eve Pokua [mailto:gorgeous65_at_msn.com]
Sent: Tuesday, July 31, 2007 4:25 AM
To: persistence_at_glassfish.dev.java.net
Subject: RE: don't have a unique key for ID in my view


  Sud,


  You may want to consider IdClass or Embeddable class.

  eve



----------------------------------------------------------------------------
    Date: Wed, 25 Jul 2007 06:20:30 -0700
    From: to_sud_at_yahoo.com
    To: persistence_at_glassfish.dev.java.net
    Subject: don't have a unique key for ID in my view


    I have a view that has neither a unique key nor a composite unique key. I have no way to specify a unique key for this view. But JPA Entities are required to have a unique Id field. How can I use JPA with my view.

    Thanks
    -sud



----------------------------------------------------------------------------
    Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.


------------------------------------------------------------------------------
  Are you the Quizmaster? Play BrainBattle with a friend now!