Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dali-dev] How to list all @Entity classes in an IJpaProject

Jack,

Yes, you should be able to get a list of the Entities in your source.  Take a look at PersistenceUnitContext.discoveredJavaPersistentTypes().  Specifically:

persistenceUnit.getJpaProject().jpaFiles(JptCorePlugin.JAVA_CONTENT_TYPE).


You can get the jpaProject from the Platform.  You will want to do some checks on this collection to get the valid annotated Entities, as seen in PersistenceUnitContext.allIncludedJavaPersistentTypes().  Specifically:

if (discoveredJpType != null && discoveredJpType.getMappingKey() != IMappingKeys.NULL_TYPE_MAPPING_KEY)


Neil

Jack Fong wrote:
Hello,

Given an IJpaProject, is there any way where I can list all the @Entity
classes please?  I'd like to list all @Entity classes in the source folder
of the JPA project, not only those listed in persistence.xml.

Thank you very much.


Regards,
Jack
                                                                            
 /                                                                          
 /                                                                          
                                                                            
 /  Jack Fong                                                               
 /  jackfong@xxxxxxxxxx                                                     
 /                                                                          
 /  Software Developer, Rational/AIM WebSphere, Java EE Application Tools   
    IBM Canada Ltd.                                                         
 /  905-413-3930 (T/L 969)                                                  
 /  D3/RKB/8200/MKM                                                         
 /                                                                          
 /                                                                          
 /                                                                          
 /                                                                          
 /                                                                          
 /                                                                          
                                                                            
                                                                            
 / (Embedded image moved to file: pic01542.gif)  (Embedded image moved to   
 / file: pic23182.gif)                                                      
                                                                            


  







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

Back to the top