<div dir="ltr">Well, besides adding this, we should think of adding also the openjpa dependency, also the hibernate impl dependency and also removing the Java EE 6 dependency. And we also have to make a more sophisticated check to make sure we apply 'or' instead of 'and' when checking for the presence of these dependencies...<div><br></div><div>Too complex and error prone in my opinion, don't you think?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 6, 2015 at 11:30 PM, George Gastaldi <span dir="ltr"><<a href="mailto:ggastald@redhat.com" target="_blank">ggastald@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div>Right, so the easiest way to solve this is to add this dependency to the JPAFacet_2_0.getRequiredDependencies(). </div><div><br></div><div>But I am not opposed on your proposed change, as long as no compilation issues happen.</div><div><br></div><div>Thanks,</div><div>George Gastaldi</div><div><br></div><div><br></div><div>-------- Mensagem original --------</div><div>De: "Ivan St. Ivanov" <<a href="mailto:ivan.st.ivanov@gmail.com" target="_blank">ivan.st.ivanov@gmail.com</a>> </div><div>Data: 06/07/2015 17:25 (GMT-03:00) </div><div>Para: forge-dev List <<a href="mailto:forge-dev@lists.jboss.org" target="_blank">forge-dev@lists.jboss.org</a>> </div><div>Assunto: Re: [forge-dev] JPA facet isInstalled implementation </div><div><br></div></div><div><div class="h5"><br><div><div dir="ltr">Hi George,<div><br></div><div>As I mentioned, I am using Eclipselink and have directly the dependency org.eclipse.persistence:eclipselink. On top of that, I don't have the Java EE API dependency. My persistence.xml is fine.</div><div><br></div><div>What I really want here is when I add a new field Forge to find out that this project has already persistence.xml and not try to rebuild it just because I am missing some dependencies in the pom.xml.</div><div><br></div><div>Cheers,</div><div>Ivan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 6, 2015 at 11:19 PM, George Gastaldi <span dir="ltr"><<a href="mailto:ggastald@redhat.com" target="_blank">ggastald@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hey Ivan,<br>
<br>
It seems that in your case the JPA 2.0 classes are defined in a
different JAR (a different groupId/artifactId) ? <br>
Your idea might work, however, just make sure that the version
attribute in the persistence.xml defines the installed facet version
(JPAFacet_2_0 when version="2.0" and JPAFacet_2_1 when
version="2.1").<br>
<br>
Best Regards,<br>
George Gastaldi<div><div><br>
<br>
<div>On 07/06/2015 05:13 PM, Ivan St. Ivanov
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi George,
<div><br>
</div>
<div>My idea is the following: if you don't have
persistence.xml, then most probably you don't have the
dependencies either. Definitely the facet is not installed, so
Forge installs it for you by adding both the persistence.xml
and the dependencies. </div>
<div><br>
</div>
<div>But if you have persistence.xml already in your project in
99% of the cases you have already setup the dependencies as
well. So the facet is there and Forge does not need to install
it.</div>
<div><br>
</div>
<div>Regards,</div>
<div>Ivan</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Jul 6, 2015 at 11:06 PM, George
Gastaldi <span dir="ltr"><<a href="mailto:ggastald@redhat.com" target="_blank">ggastald@redhat.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Hi Ivan,<br>
<br>
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?<br>
<br>
Best Regards,<br>
<br>
George Gastaldi
<div>
<div><br>
<br>
<div>On 07/06/2015 05:02 PM, Ivan St. Ivanov wrote:<br>
</div>
</div>
</div>
<blockquote type="cite">
<div>
<div>
<div dir="ltr">Hi everybody,
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>So my proposal is to change the isInstalled
method to only check for the presence of
persistence.xml. What do you think?</div>
<div><br>
</div>
<div>Regards,</div>
<div>Ivan</div>
</div>
<br>
<fieldset></fieldset>
<br>
</div>
</div>
<pre>_______________________________________________
forge-dev mailing list
<a href="mailto:forge-dev@lists.jboss.org" target="_blank">forge-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/forge-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a></pre>
</blockquote>
<br>
</div>
<br>
_______________________________________________<br>
forge-dev mailing list<br>
<a href="mailto:forge-dev@lists.jboss.org" target="_blank">forge-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/forge-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a><br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
forge-dev mailing list
<a href="mailto:forge-dev@lists.jboss.org" target="_blank">forge-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/forge-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a></pre>
</blockquote>
<br>
</div></div></div>
<br>_______________________________________________<br>
forge-dev mailing list<br>
<a href="mailto:forge-dev@lists.jboss.org" target="_blank">forge-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/forge-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a><br></blockquote></div><br></div>
</div></div></div></div><br>_______________________________________________<br>
forge-dev mailing list<br>
<a href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/forge-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a><br></blockquote></div><br></div>