Home > Blockchain >  What are the values and their differences for eclipselink.weaving property?
What are the values and their differences for eclipselink.weaving property?

Time:11-29

Which values exist for the eclipselink.weaving property and what is their meaning?

In Spring we can create the entityManager using Java configuration or XML configuration, the following example is for XML:

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="jpaProperties">
        <props>
            <prop key="eclipselink.weaving">false</prop>
            ...
        </props>
    </property>
   ...
</bean>

We have the following option:

  • static - to static weaving to weave all applicable class files at build time so that you can deliver pre-woven class files.

What does the false means? And which options can we pass to eclipselink.weaving property?

EDIT: I want to configure the weaving during compile time. I am using this maven plugin

<groupId>com.ethlo.persistence.tools</groupId>
<artifactId>eclipselink-maven-plugin</artifactId>

What value should I use false or static ?

CodePudding user response:

Javadoc for the eclipselink.weaving property state 3 values:

  • "true" - requires that weaving is done. Will throw an exception if entities are not woven
  • "false" - forces weaving not to be done
  • "static" - requires that the static weaving utility was used to weave the entities

True aka Dynamic implies there is an agent that will weave the entities in the JVM. See the doc for setting it up outside of a container. Static tells EclipseLink you've done the weaving yourself on the java classes within the class loader (see the wiki for how to set it up), while false turns off any options that require woven classes (change tracking, lazy one to ones and more).

  • Related