Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] is it possible to get fully qualified classnames of entities from JPA query?

Does something like this help?  

public static List<Class> getBeanClasses(EntityManager em) {
    List<Class> classes = new ArrayList<Class>();
    EntityManagerImpl emImpl = (EntityManagerImpl)em;
    if (emImpl != null && emImpl.isOpen()) {
      ServerSession ss = emImpl.getServerSession();
      if (ss != null) {
        Project project = ss.getProject();
        if (project != null) {
          Map descriptors = project.getDescriptors();
          if (descriptors != null) {
            Set<Class> clazzes = descriptors.keySet();
            if (clazzes != null) {
              for (Class clazz : clazzes) {
                classes.add(clazz);
              }
            }
          }
        }
      }
    }
    return classes;
  }


On Mon, Nov 5, 2012 at 5:38 AM, manishwarekar <manishwarekar@xxxxxxxxx> wrote:
For example, if a query is SELECT obj1.id, obj2.id FROM Object1 obj1, Object2 obj1; will return the fully qualified class names, is it possible to get fully qualified class names of entities i.e. com.example.Object1 and com.example.Object2 ??

View this message in context: is it possible to get fully qualified classnames of entities from JPA query?
Sent from the EclipseLink - Users mailing list archive at Nabble.com.

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users




--

Mark Millman | Mizar, LLC
mark.millman@xxxxxxxxx | www.mizar.com
office (360) 945-2643 | mobile (360) 220-3504
Google voice (rings both numbers) (360) 36-ALCOR
589 S Beach Rd. | Point Roberts, WA 98281

 The information contained in this communication may be confidential, is intended only for the use of the recipient(s) named above, and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please return it to the sender immediately and delete the original message and any copy of it from your computer system. If you have any questions concerning this message, please contact the sender.



Back to the top