Issue
We use EclipseLink as our JPA provider.
I find a lot of answers online that talk about the persistence.xml
solutions, but I'm actually trying to avoid using XML configuration. I even read that SpringBoot now doesn't even look for that file anymore unless told to. For this reason, I want to try to stick to application.properties
.
It seems like Hibernate has decent support through passing spring.jpa.hibernate
properties. However, I'm left hanging when it comes to EclipseLink.
I'm trying to:
- Set the EclipseLink logging to
ALL
to help me debug. - Activate the EclipseLink Batch-Writing to see if I can improve the performance of my application.
This is my current application.properties
:
logging.level.root=info
spring.jpa.show-sql=true
eclipselink.jdbc.batch-writing=JDBC
eclipselink.jdbc.batch-writing.size=500
I tried plugging the values of some of these answers into the application.properties
but it didn't really help me see SQL commands. The only way I could get to see some SQLs was with spring.jpa.show-sql=true
which lead me to believe that it's not as trivial as I'd expect to avoid using persistence.xml
. This also makes me suspect that the eclipselink.jdbc.batch-writing
properties are also not actually being recognized by EclipseLink.
We do log through logback
. Maybe this logback.xml
file content could be helpful:
<?xml version="1.0" encoding="UTF-8" ?>
<configuration scan="true" scanPeriod="2 seconds" debug="false">
<appender name="log.console" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="com.foo.bar.app.LoggerLayoutEncoder">
<pattern>%d{HH:mm:ss.SSSS} -\t%highlight(%-5level)\t%17.-17tenantContext\t%15.-15userContext\t%50.-50requestContext\tThread[%26.-26thread]%n\t\t\t\tLogger[%green(%36.36(%logger{36}))]\tMsg[%highlight(%msg)]%n</pattern>
</encoder>
</appender>
<appender name="Sentry" class="io.sentry.logback.SentryAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="log.console" />
<appender-ref ref="Sentry" />
</root>
</configuration>
Solution
Turns out it was a bug in my company's internal framework which prevented the eclipselink
properties from being inherited by the EntityManager
.
Please disregard.
Answered By - payne