Hi,
I am using hibernate 4.0.1 for CRUD operations upon page replication. For this i have written eventhandler, in handleEvent method i am writing logic to persist page property in database using hibernate.
I am getting class not found error in hibernate. added all dependencies in POM file, showing all jars in classpath too, bundle is deployed successfully and it is in active state.
hibernate.cfg.xml i have put in src/main/resources folder and added this folder in classpath.
java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
Could anyone please help me to resolve the issue, below piece of code is causing the problem
Configuration configuration = new Configuration().configure();
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(
configuration.getProperties()). buildServiceRegistry();
SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry);
Session session = sessionFactory.openSession();
Thanks,
Pradeep
Solved! Go to Solution.
Hi Pradeep,
As Scott stated, the best practice to connect AEM with database is injecting a DataSourcePool.
But Yes, AEM may support hibernate too(http://mvnrepository.com/artifact/org.hibernate/hibernate-osgi), but there is no documentation/community articles related to this topic.
Thanks,
Ratna Kumar.
Views
Replies
Total Likes
When working with AEM and databases - the best practice is injecting a DataSourcePool - not using Hibernate.
WHen using a DataSourcePool - you specify the DB properties in the Felix Console config view.
See this article for more information:
https://helpx.adobe.com/experience-manager/using/datasourcepool.html
Views
Replies
Total Likes
The problem with data source pool is that we have to write sql queries for all crud operations. In my case we have very complex table structure, so writing sql is very tedious task. If hibernate would have supported in AEM my job will become easy and manageable. I am assuming AEM supports hibernate. Please share some links or examples where hibernate has been used along with AEM.
Views
Replies
Total Likes
It may support Hibernate - however - I am not seeing any community articles or documentation that states it does.
Also - I wanted to know why you were not using DataSoucePool - which is best practice. You answered my question.
I will check within Adobe to see if anyone has examples (assuming it does).
I will post back my findings.
Views
Replies
Total Likes
Thanks Donald.
Views
Replies
Total Likes
Hi Pradeep,
As Scott stated, the best practice to connect AEM with database is injecting a DataSourcePool.
But Yes, AEM may support hibernate too(http://mvnrepository.com/artifact/org.hibernate/hibernate-osgi), but there is no documentation/community articles related to this topic.
Thanks,
Ratna Kumar.
Views
Replies
Total Likes
Some of the AEM people state:
they can try out the bundle and see what happens. :)
In theory it should work.
Views
Replies
Total Likes
Hi,
Any luck with Hibernate inside the AEM?
Thanks,
Andrii
Views
Replies
Total Likes
Database interaction still has not changed since this thread was created. Using DataSourcePool is still best practice. We have a newer article here:
Adobe Experience Manager Help | Submitting Adaptive Form Data to MySQL using a DataSourcePool
Now there appears to be 3rd party OSGi bundles for this here - Maven Repository: org.hibernate » hibernate-osgi
I have never tried this nor seen any community article that show its usage.
Views
Replies
Total Likes
Hi Scott,
Thanks for the response, I was also not able to find any articles or info how to configure it or at list resolve dependencies for this bundle.
Maybe Pradeep or someone from the community has some experience.
Best regards,
Andrii
Views
Replies
Total Likes
this is like bullshit. the Datasourcepool has nothing common with hibernate, it just connect your application with the database.
Why is there no support for config hibernate with AEM CQ?
I think many companies would like to use hibernate with CQ.
Hi,
Hibernate is also a way to connect to database, but when it comes to AEM, the out of the box(OOTB) way is Data Sourcepool.
Thanks,
Ratna Kumar.
Views
Replies
Total Likes
Ok so to build a complex database diagram I have to work like in 1950?
Or is there any other possibility for complex datastructures? With a lot of dependencies between the tables, and a lot of attributes, to generate them automatically?
Views
Replies
Total Likes
I've found the solution!!!!!!!!!!!!!!!
In my Situation I use AEM 6.4 with Servicepack 1 and AEM Forms, in the backend I have an Oracle Database.
So I need the dependency for
You should Embedd thos dependencies in your Bundle project
Next I had to configure a hibernate.cfg.xml and save it in the resources Folder in the bundle project. All of the Entity classes need to be listed in the cfg.xml
Here the sample
So far so Good. Now we need some magic.
I made an Activator and an HibernateUtil Klass. The Activator is calling the HibernateUtil Class on Startup to setup the connection to your database. I also made a Transaction and commit an entry.
Attention: add the Activator in your bundle pom
Your Activator class hass to implement the BundleActivator class. In the start method you have to call your HibernateUtil class to get the SessionFactory
And in the HibernateUtil class you have to read the hibernate config from resource and work with your sessionFactory
After calling this Method, you see now the Generated Tables from the Entity classes.
This is how far I am now. But I think it looks not so bad.
Here The Entity Class Author
This should be marked as the right answer, and not the answer from the people who told you just to use Datasource -.-
Hi @fabianh12876403
looks interesting. I wonder how this works together with the way OSGI manages classloaders. I could imagine that there are cases where you end up in classloader hell... Can you share some experience?
Jörg
Views
Replies
Total Likes
DataSourcePool is the solution that the AEM Eng team has created to interact with relational databases. That is why its marked as correct.
The AEM Eng team have not created an OOTB OSGI solution for hibernate.
If you think this is a proper solution, you can write up a Word doc and we will submit to the AEM Eng team to get their thoughts. Once they approve this approach, we will gladly publish this solution.
Views
Replies
Total Likes
We have integrated Hibernate 5.4.5 and JPA 2.2 into Adobe Experience Manager 6.4.4 using two approaches below. Please, check https://soft-werke.com/en/archives/news-en/how-to-install-hibernate-5-4-5-jpa-2-2-in-adobe-experienc... for more details.
<profiles>
<profile>
<id>installHibernate</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.day.jcr.vault</groupId>
<artifactId>content-package-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<embeddedTarget>/apps/hibernate/install</embeddedTarget>
<embeddeds>
<embedded>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.antlr</artifactId>
</embedded>
<embedded>
<groupId>com.fasterxml</groupId>
<artifactId>classmate</artifactId>
</embedded>
<embedded>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
</embedded>
<embedded>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
</embedded>
<embedded>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
</embedded>
<embedded>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</embedded>
<embedded>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
</embedded>
<embedded>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.dom4j</artifactId>
</embedded>
<embedded>
<groupId>com.sun.istack</groupId>
<artifactId>istack-commons-runtime</artifactId>
</embedded>
<embedded>
<groupId>com.sun.xml.fastinfoset</groupId>
<artifactId>FastInfoset</artifactId>
</embedded>
<embedded>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.jaxb-runtime</artifactId>
</embedded>
<embedded>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</embedded>
<embedded>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</embedded>
<embedded>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
</embedded>
<embedded>
<groupId>org.jboss</groupId>
<artifactId>jandex</artifactId>
</embedded>
<embedded>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
</embedded>
<embedded>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.javax-inject</artifactId>
</embedded>
<embedded>
<groupId>javax.interceptor</groupId>
<artifactId>javax.interceptor-api</artifactId>
</embedded>
<embedded>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
</embedded>
<embedded>
<groupId>org.jboss.spec.javax.interceptor</groupId>
<artifactId>jboss-interceptors-api_1.2_spec</artifactId>
</embedded>
<embedded>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.2_spec</artifactId>
</embedded>
<embedded>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</embedded>
<embedded>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</embedded>
<embedded>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-osgi</artifactId>
</embedded>
</embeddeds>
</configuration>
<executions>
<execution>
<id>install-package-hibernate</id>
<goals>
<goal>install</goal>
</goals>
<configuration>
<targetURL>http://${aem.host}:${aem.port}/crx/packmgr/service.jsp</targetURL>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<!-- Other dependencies ... -->
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-osgi</artifactId>
<version>5.4.5.Final</version>
</dependency>
<!-- Other dependencies ... -->
</dependencies>
<profiles>
<profile>
<id>installHibernate</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>rg</groupId>
<artifactId>com.softwerke.jpa.hibernate.bundles</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${basedir}/src/main/content/jcr_root/apps/hibernate/install/
</outputDirectory>
<includeArtifactIds>
org.apache.servicemix.bundles.antlr,
classmate,
javax.activation,
javax.activation-api,
javax.persistence-api,
jaxb-api,
byte-buddy,
org.apache.servicemix.bundles.dom4j,
istack-commons-runtime,
FastInfoset,
org.apache.servicemix.bundles.jaxb-runtime,
javassist,
jboss-logging,
hibernate-commons-annotations,
jandex,
javax.el-api,
org.apache.servicemix.bundles.javax-inject,
javax.interceptor-api,
cdi-api,
jboss-interceptors-api_1.2_spec,
jboss-transaction-api_1.2_spec,
mysql-connector-java,
hibernate-core,
hibernate-osgi
</includeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.softwerke.build.utils.HibernateInstaller</mainClass>
<classpathScope>compile</classpathScope>
<arguments>
<!-- Path to load Hibernate OSGi dependencies from -->
<argument>${basedir}/src/main/content/jcr_root/apps/hibernate/install</argument>
<!-- Path to XML file with a list of Hibernate bundles -->
<argument>${basedir}/src/main/content/META-INF/resources/hibernate-bundles.xml</argument>
<!-- User login to install bundle in AEM -->
<argument>${sling.user}</argument>
<!-- User password to install bundle in AEM -->
<argument>${sling.password}</argument>
<!-- Path to AEM Felix Console -->
<argument>http://${aem.host}:${aem.port}/system/console</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Java code for Hibernate bundle installation with Maven Invoker API:
public class HibernateInstaller {
public static void main(String[] args) throws Exception {
String bundleFolder,
xmlFilePath,
slingUser,
slingPassword,
url;
if (args != null && args.length == 5) {
bundleFolder = args[0];
xmlFilePath = args[1];
slingUser = args[2];
slingPassword = args[3];
url = args[4];
} else {
throw new Exception("Can't execute Hibernate install!\nPlease specify five arguments.");
}
StringBuilder mvnCmd = new StringBuilder();
mvnCmd.append("org.apache.sling:sling-maven-plugin:2.4.2:install-file");
mvnCmd.append(" -Dsling.user=" + slingUser);
mvnCmd.append(" -Dsling.password=" + slingPassword);
mvnCmd.append(" -Dsling.url=" + url);
mvnCmd.append(" -Dsling.deploy.method=WebConsole");
mvnCmd.append(" -Dsling.file=");
mvnCmd.append(bundleFolder);
mvnCmd.append("/");
// Read XML file with a list of the Hibernate OSGi dependencies (bundles)
File file = new File(xmlFilePath);
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse(file);
NodeList bundlesList = document.getElementsByTagName("bundle");
final InvocationRequest invocationRequest = new DefaultInvocationRequest();
// invocationRequest.setDebug(true);
final Invoker invoker = new DefaultInvoker();
for (int i = 0; i < bundlesList.getLength(); i++) {
String goal = mvnCmd.toString() + bundlesList.item(i).getTextContent();
installBundle(invocationRequest, invoker, goal);
}
}
private static void installBundle(InvocationRequest invocationRequest, Invoker invoker, String goal)
throws MavenInvocationException, CommandLineException {
invocationRequest.setGoals(Collections.singletonList(goal));
final InvocationResult invocationResult = invoker.execute(invocationRequest);
if (invocationResult.getExitCode() != 0) {
String msg = "Invocation Exception";
if (invocationResult.getExecutionException() != null) {
msg = invocationResult.getExecutionException().getMessage();
}
throw new CommandLineException(msg);
}
}
}
P.S.
In case you once decide to switch to another ORM framework, it's better to prefer JPA EntityManagerFactory approach instead of Hibernate-specific SessionFactory - check https://stackoverflow.com/a/5640796/12547140.
Views
Replies
Total Likes
We have integrated Hibernate 5.4.5 and JPA 2.2 into Adobe Experience Manager 6.4.4 using two approaches below. Please, check https://soft-werke.com/en/archives/news-en/how-to-install-hibernate-5-4-5-jpa-2-2-in-adobe-experienc... for more details.
<profiles>
<profile>
<id>installHibernate</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.day.jcr.vault</groupId>
<artifactId>content-package-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<embeddedTarget>/apps/hibernate/install</embeddedTarget>
<embeddeds>
<embedded>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.antlr</artifactId>
</embedded>
<embedded>
<groupId>com.fasterxml</groupId>
<artifactId>classmate</artifactId>
</embedded>
<embedded>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
</embedded>
<embedded>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
</embedded>
<embedded>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
</embedded>
<embedded>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</embedded>
<embedded>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
</embedded>
<embedded>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.dom4j</artifactId>
</embedded>
<embedded>
<groupId>com.sun.istack</groupId>
<artifactId>istack-commons-runtime</artifactId>
</embedded>
<embedded>
<groupId>com.sun.xml.fastinfoset</groupId>
<artifactId>FastInfoset</artifactId>
</embedded>
<embedded>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.jaxb-runtime</artifactId>
</embedded>
<embedded>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</embedded>
<embedded>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</embedded>
<embedded>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
</embedded>
<embedded>
<groupId>org.jboss</groupId>
<artifactId>jandex</artifactId>
</embedded>
<embedded>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
</embedded>
<embedded>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.javax-inject</artifactId>
</embedded>
<embedded>
<groupId>javax.interceptor</groupId>
<artifactId>javax.interceptor-api</artifactId>
</embedded>
<embedded>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
</embedded>
<embedded>
<groupId>org.jboss.spec.javax.interceptor</groupId>
<artifactId>jboss-interceptors-api_1.2_spec</artifactId>
</embedded>
<embedded>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.2_spec</artifactId>
</embedded>
<embedded>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</embedded>
<embedded>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</embedded>
<embedded>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-osgi</artifactId>
</embedded>
</embeddeds>
</configuration>
<executions>
<execution>
<id>install-package-hibernate</id>
<goals>
<goal>install</goal>
</goals>
<configuration>
<targetURL>http://${aem.host}:${aem.port}/crx/packmgr/service.jsp</targetURL>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<!-- Other dependencies... -->
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-osgi</artifactId>
<version>5.4.5.Final</version>
</dependency>
<!-- Other dependencies... -->
</dependencies>
<profiles>
<profile>
<id>installHibernate</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>rg</groupId>
<artifactId>com.softwerke.jpa.hibernate.bundles</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${basedir}/src/main/content/jcr_root/apps/hibernate/install/
</outputDirectory>
<includeArtifactIds>
org.apache.servicemix.bundles.antlr,
classmate,
javax.activation,
javax.activation-api,
javax.persistence-api,
jaxb-api,
byte-buddy,
org.apache.servicemix.bundles.dom4j,
istack-commons-runtime,
FastInfoset,
org.apache.servicemix.bundles.jaxb-runtime,
javassist,
jboss-logging,
hibernate-commons-annotations,
jandex,
javax.el-api,
org.apache.servicemix.bundles.javax-inject,
javax.interceptor-api,
cdi-api,
jboss-interceptors-api_1.2_spec,
jboss-transaction-api_1.2_spec,
mysql-connector-java,
hibernate-core,
hibernate-osgi
</includeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.softwerke.build.utils.HibernateInstaller</mainClass>
<classpathScope>compile</classpathScope>
<arguments>
<!-- Path to load Hibernate OSGi dependencies from -->
<argument>${basedir}/src/main/content/jcr_root/apps/hibernate/install</argument>
<!-- Path to XML file with a list of Hibernate bundles -->
<argument>${basedir}/src/main/content/META-INF/resources/hibernate-bundles.xml</argument>
<!-- User login to install bundle in AEM -->
<argument>${sling.user}</argument>
<!-- User password to install bundle in AEM -->
<argument>${sling.password}</argument>
<!-- Path to AEM Felix Console -->
<argument>http://${aem.host}:${aem.port}/system/console</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Java code for Hibernate bundle installation with Maven Invoker API:
public class HibernateInstaller {
public static void main(String[] args) throws Exception {
String bundleFolder,
xmlFilePath,
slingUser,
slingPassword,
url;
if (args != null && args.length == 5) {
bundleFolder = args[0];
xmlFilePath = args[1];
slingUser = args[2];
slingPassword = args[3];
url = args[4];
} else {
throw new Exception("Can't execute Hibernate install!\nPlease specify five arguments.");
}
StringBuilder mvnCmd = new StringBuilder();
mvnCmd.append("org.apache.sling:sling-maven-plugin:2.4.2:install-file");
mvnCmd.append(" -Dsling.user=" + slingUser);
mvnCmd.append(" -Dsling.password=" + slingPassword);
mvnCmd.append(" -Dsling.url=" + url);
mvnCmd.append(" -Dsling.deploy.method=WebConsole");
mvnCmd.append(" -Dsling.file=");
mvnCmd.append(bundleFolder);
mvnCmd.append("/");
// Read XML file with a list of the Hibernate OSGi dependencies (bundles)
File file = new File(xmlFilePath);
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse(file);
NodeList bundlesList = document.getElementsByTagName("bundle");
final InvocationRequest invocationRequest = new DefaultInvocationRequest();
// invocationRequest.setDebug(true);
final Invoker invoker = new DefaultInvoker();
for (int i = 0; i < bundlesList.getLength(); i++) {
String goal = mvnCmd.toString() + bundlesList.item(i).getTextContent();
installBundle(invocationRequest, invoker, goal);
}
}
private static void installBundle(InvocationRequest invocationRequest, Invoker invoker, String goal)
throws MavenInvocationException, CommandLineException {
invocationRequest.setGoals(Collections.singletonList(goal));
final InvocationResult invocationResult = invoker.execute(invocationRequest);
if (invocationResult.getExitCode() != 0) {
String msg = "Invocation Exception";
if (invocationResult.getExecutionException() != null) {
msg = invocationResult.getExecutionException().getMessage();
}
throw new CommandLineException(msg);
}
}
}
P.S.
In case you once decide to switch to another ORM framework, it's better to prefer JPA EntityManagerFactory approach instead of Hibernate-specific SessionFactory - check https://stackoverflow.com/a/5640796/12547140.
Views
Replies
Total Likes
Views
Likes
Replies