[forge-dev] JPA facet isInstalled implementation

George Gastaldi ggastald at redhat.com
Mon Jul 6 16:06:07 EDT 2015


Hi Ivan,

I am not sure this is enough. How can you assure that no compilation 
errors would occur when @Entity or any other JPA-related class is used?

Best Regards,

George Gastaldi

On 07/06/2015 05:02 PM, Ivan St. Ivanov wrote:
> Hi everybody,
>
> I am working on a project that is not mainstream Java EE. Its target 
> is Tomcat, but it uses JPA 2.0 (Eclipselink). I have tailored the 
> dependencies in the pom.xml as well as the persistence.xml.
>
> And now I want to use Forge to add some fields to the existing 
> entities. What I noticed is that when I run the jpa-new-field command 
> for the first time, it also installs the JPA facet. Which in turns 
> adds some unwanted dependencies to my pom.xml and completely 
> overwrites persistence.xml.
>
> I dig into the code and found that the isInstalled method of the JPA 
> Facet returns true when persistence.xml file does not exist and when 
> pom.xml does not contain some dependencies. These dependencies are 
> different for JPA 2.0 and 2.1, but are basically Hibernate JPA API and 
> the Java EE API.
>
> As a result of this, projects that don't target Java EE or that use 
> different artifacts for it or for JPA are going to get their poms 
> polluted and their persistence.xml files overwritten.
>
> So my proposal is to change the isInstalled method to only check for 
> the presence of persistence.xml. What do you think?
>
> Regards,
> Ivan
>
>
> _______________________________________________
> forge-dev mailing list
> forge-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20150706/8f9db26a/attachment.html 


More information about the forge-dev mailing list