Csaba Meszaros 8 Years Ago Two questions:1). Can one serviceBuilder define multiple entities/tables like in Liferay 6?2). If I have done everything, how can I see these tables. What are the steps in gradle? I simply cannot force LR7 to create the actual tables in MySQL database, although I have all the stuff ready, but still missing the table. Please sign in to reply. Reply as... Cancel David H Nebinger Csaba Meszaros 8 Years Ago What version of Liferay are you using? Yes, SB will create the tables but you should check to see if maybe they weren't already created in the portal database (not your external database). I do believe, however, there may have been some initial bugs preventing the tables from being created. If you still have a problem in the latest GA, I would report it on issues.liferay.com and possibly take it up in the forums also. Please sign in to reply. Reply as... Cancel Csaba Meszaros David H Nebinger 8 Years Ago In fact, I am trying to create tables inside the portal's database. I managed to create one custom entity, but I am having problems adding another. I have 2 entities defined in service.xml, but I am not sure what's the right way of making them instantiated in database. I see the first table, but not the second one. And when I try to insert a record, I am getting error table doesn't exist. I am using LR 7.0 CE GA3. So, how is supposed to create these tables physically? Please sign in to reply. Reply as... Cancel pawan kumar David H Nebinger 8 Years Ago Hi David,I am using Liferay 7 and written more than 1 Entity into service.xml .Its not creating the table for local database even.For one entity it works. Please sign in to reply. Reply as... Cancel
David H Nebinger Csaba Meszaros 8 Years Ago What version of Liferay are you using? Yes, SB will create the tables but you should check to see if maybe they weren't already created in the portal database (not your external database). I do believe, however, there may have been some initial bugs preventing the tables from being created. If you still have a problem in the latest GA, I would report it on issues.liferay.com and possibly take it up in the forums also. Please sign in to reply. Reply as... Cancel Csaba Meszaros David H Nebinger 8 Years Ago In fact, I am trying to create tables inside the portal's database. I managed to create one custom entity, but I am having problems adding another. I have 2 entities defined in service.xml, but I am not sure what's the right way of making them instantiated in database. I see the first table, but not the second one. And when I try to insert a record, I am getting error table doesn't exist. I am using LR 7.0 CE GA3. So, how is supposed to create these tables physically? Please sign in to reply. Reply as... Cancel pawan kumar David H Nebinger 8 Years Ago Hi David,I am using Liferay 7 and written more than 1 Entity into service.xml .Its not creating the table for local database even.For one entity it works. Please sign in to reply. Reply as... Cancel
Csaba Meszaros David H Nebinger 8 Years Ago In fact, I am trying to create tables inside the portal's database. I managed to create one custom entity, but I am having problems adding another. I have 2 entities defined in service.xml, but I am not sure what's the right way of making them instantiated in database. I see the first table, but not the second one. And when I try to insert a record, I am getting error table doesn't exist. I am using LR 7.0 CE GA3. So, how is supposed to create these tables physically? Please sign in to reply. Reply as... Cancel
pawan kumar David H Nebinger 8 Years Ago Hi David,I am using Liferay 7 and written more than 1 Entity into service.xml .Its not creating the table for local database even.For one entity it works. Please sign in to reply. Reply as... Cancel
Le An 8 Years Ago Hello DAVID H NEBINGER, I just want to change database name only. for example my portal using postgre database with name: person. then I want the service builder to use the postgre with the name changed to personNew.Can you help me in this case?Many thanks? Please sign in to reply. Reply as... Cancel
Le An 8 Years Ago Hello DAVID H NEBINGER, I just want to change database name only. for example my portal using postgre database with name: person. then I want the service builder to use the postgre with the name changed to personNew.Can you help me in this case?Many thanks? Please sign in to reply. Reply as... Cancel
Suresh Yadagiri 8 Years Ago Hi David,Is there any change Liferay 7.0 service builder when writing custom SQL? when I run service builder after writing FinderImpl it's not generating FinderUtil class. it does generated LocalServiceImpl. Also my FinderImpl extends BasePersistenceImpl<Event> replaced by extends EventFinderBaseImpl. Please sign in to reply. Reply as... Cancel David H Nebinger Suresh Yadagiri 8 Years Ago In Liferay 7 you should never be using the Util classes. Instead you declare a variable and use @Reference to have OSGi inject it.Also, a custom SQL through the finder, you should be accessing through the member variable injected into your XxxLocalServiceImpl class anyway. External classes should never be using the finder directly because it really violates the core concepts of OOP encapsulation.So I guess I don't know if the finderutil thing is a bug or not, but since you should not be using it and should not be exposing it, it doesn't quite matter. Please sign in to reply. Reply as... Cancel Suresh Yadagiri David H Nebinger 8 Years Ago Thanks David. Till 6.2 FinderUtils created and missing now. I will try to access FinderImpl methods through LocalServiceImpl. I use Util classes when I access from JSPs (Ex: when I use Search Container)..Inside Portlet classes I will use @Reference. Please sign in to reply. Reply as... Cancel David H Nebinger Suresh Yadagiri 8 Years Ago You get the same outcome if you add a method to the XxxLocalServiceImpl class; the XxxLocalServiceUtil will have the exposed method.BTW, check out the blade samples, specifically the service builder web example. In the pattern laid out there, the portlet class' render() method is used to inject references into the render attributes and extract them in the init.jsp file.That way the Xxx[Local]ServiceUtil classes can be avoided in a pure OSGi implementation. Please sign in to reply. Reply as... Cancel Rajesh Rathod David H Nebinger 8 Years Ago Hi David,I have followed same steps as mentioned in your blog. However there is one small change at my side and its not working for me.Changes1) portal-ext.properties has JNDI entry to connect with Liferay Database.2) I would like to connect OSGI service builder with external database using JNDI.So I have done following change in ext-spring.xml and rest is same as you have mentioned.<bean class="com.liferay.portal.spring.jndi.JndiObjectFactoryBean" id="liferayDataSourceImpl"> <property name="jndiName" value="jdbc/BaseDBPool"/></bean>When I invoke any getXXX() method from web module its throwing NPE. I did further analysis and found that when I am using JNDI as datasource its not even registering OSGI service.Your help is very much appreciated. Please sign in to reply. Reply as... Cancel
David H Nebinger Suresh Yadagiri 8 Years Ago In Liferay 7 you should never be using the Util classes. Instead you declare a variable and use @Reference to have OSGi inject it.Also, a custom SQL through the finder, you should be accessing through the member variable injected into your XxxLocalServiceImpl class anyway. External classes should never be using the finder directly because it really violates the core concepts of OOP encapsulation.So I guess I don't know if the finderutil thing is a bug or not, but since you should not be using it and should not be exposing it, it doesn't quite matter. Please sign in to reply. Reply as... Cancel Suresh Yadagiri David H Nebinger 8 Years Ago Thanks David. Till 6.2 FinderUtils created and missing now. I will try to access FinderImpl methods through LocalServiceImpl. I use Util classes when I access from JSPs (Ex: when I use Search Container)..Inside Portlet classes I will use @Reference. Please sign in to reply. Reply as... Cancel David H Nebinger Suresh Yadagiri 8 Years Ago You get the same outcome if you add a method to the XxxLocalServiceImpl class; the XxxLocalServiceUtil will have the exposed method.BTW, check out the blade samples, specifically the service builder web example. In the pattern laid out there, the portlet class' render() method is used to inject references into the render attributes and extract them in the init.jsp file.That way the Xxx[Local]ServiceUtil classes can be avoided in a pure OSGi implementation. Please sign in to reply. Reply as... Cancel Rajesh Rathod David H Nebinger 8 Years Ago Hi David,I have followed same steps as mentioned in your blog. However there is one small change at my side and its not working for me.Changes1) portal-ext.properties has JNDI entry to connect with Liferay Database.2) I would like to connect OSGI service builder with external database using JNDI.So I have done following change in ext-spring.xml and rest is same as you have mentioned.<bean class="com.liferay.portal.spring.jndi.JndiObjectFactoryBean" id="liferayDataSourceImpl"> <property name="jndiName" value="jdbc/BaseDBPool"/></bean>When I invoke any getXXX() method from web module its throwing NPE. I did further analysis and found that when I am using JNDI as datasource its not even registering OSGI service.Your help is very much appreciated. Please sign in to reply. Reply as... Cancel
Suresh Yadagiri David H Nebinger 8 Years Ago Thanks David. Till 6.2 FinderUtils created and missing now. I will try to access FinderImpl methods through LocalServiceImpl. I use Util classes when I access from JSPs (Ex: when I use Search Container)..Inside Portlet classes I will use @Reference. Please sign in to reply. Reply as... Cancel David H Nebinger Suresh Yadagiri 8 Years Ago You get the same outcome if you add a method to the XxxLocalServiceImpl class; the XxxLocalServiceUtil will have the exposed method.BTW, check out the blade samples, specifically the service builder web example. In the pattern laid out there, the portlet class' render() method is used to inject references into the render attributes and extract them in the init.jsp file.That way the Xxx[Local]ServiceUtil classes can be avoided in a pure OSGi implementation. Please sign in to reply. Reply as... Cancel Rajesh Rathod David H Nebinger 8 Years Ago Hi David,I have followed same steps as mentioned in your blog. However there is one small change at my side and its not working for me.Changes1) portal-ext.properties has JNDI entry to connect with Liferay Database.2) I would like to connect OSGI service builder with external database using JNDI.So I have done following change in ext-spring.xml and rest is same as you have mentioned.<bean class="com.liferay.portal.spring.jndi.JndiObjectFactoryBean" id="liferayDataSourceImpl"> <property name="jndiName" value="jdbc/BaseDBPool"/></bean>When I invoke any getXXX() method from web module its throwing NPE. I did further analysis and found that when I am using JNDI as datasource its not even registering OSGI service.Your help is very much appreciated. Please sign in to reply. Reply as... Cancel
David H Nebinger Suresh Yadagiri 8 Years Ago You get the same outcome if you add a method to the XxxLocalServiceImpl class; the XxxLocalServiceUtil will have the exposed method.BTW, check out the blade samples, specifically the service builder web example. In the pattern laid out there, the portlet class' render() method is used to inject references into the render attributes and extract them in the init.jsp file.That way the Xxx[Local]ServiceUtil classes can be avoided in a pure OSGi implementation. Please sign in to reply. Reply as... Cancel Rajesh Rathod David H Nebinger 8 Years Ago Hi David,I have followed same steps as mentioned in your blog. However there is one small change at my side and its not working for me.Changes1) portal-ext.properties has JNDI entry to connect with Liferay Database.2) I would like to connect OSGI service builder with external database using JNDI.So I have done following change in ext-spring.xml and rest is same as you have mentioned.<bean class="com.liferay.portal.spring.jndi.JndiObjectFactoryBean" id="liferayDataSourceImpl"> <property name="jndiName" value="jdbc/BaseDBPool"/></bean>When I invoke any getXXX() method from web module its throwing NPE. I did further analysis and found that when I am using JNDI as datasource its not even registering OSGI service.Your help is very much appreciated. Please sign in to reply. Reply as... Cancel
Rajesh Rathod David H Nebinger 8 Years Ago Hi David,I have followed same steps as mentioned in your blog. However there is one small change at my side and its not working for me.Changes1) portal-ext.properties has JNDI entry to connect with Liferay Database.2) I would like to connect OSGI service builder with external database using JNDI.So I have done following change in ext-spring.xml and rest is same as you have mentioned.<bean class="com.liferay.portal.spring.jndi.JndiObjectFactoryBean" id="liferayDataSourceImpl"> <property name="jndiName" value="jdbc/BaseDBPool"/></bean>When I invoke any getXXX() method from web module its throwing NPE. I did further analysis and found that when I am using JNDI as datasource its not even registering OSGI service.Your help is very much appreciated. Please sign in to reply. Reply as... Cancel
Murali Krishna 8 Years Ago if we are diffing the extDatasource, how we can connect to multiple(>3) databases ? Please sign in to reply. Reply as... Cancel David H Nebinger Murali Krishna 8 Years Ago You need to create separate modules for each datasource as indicated in the blog. Please sign in to reply. Reply as... Cancel
David H Nebinger Murali Krishna 8 Years Ago You need to create separate modules for each datasource as indicated in the blog. Please sign in to reply. Reply as... Cancel
sam moses segal 8 Years Ago Is it possible top deploy a data source at runtime? Please sign in to reply. Reply as... Cancel
Marco Napolitano 8 Years Ago Hi David,what about SessionFactory and TxManager configuration?I have Liferay (DXP SP12) on a MySQL database and I need to read some data to an external SQL Server database.If I don't specify the session-factory parameters in service.xml, Liferay look for the external table inside the Liferay database and it doesn't work.But specifying the session-factory parameters (but I'm not sure how to configure the ext-spring.xml correctly) I always get an Hibernate error when I call the "count" method: org.hibernate.QueryException: in expected: mytable [SELECT COUNT(*) FROM Mytable mytable].ByeMarco Please sign in to reply. Reply as... Cancel Marco Napolitano Marco Napolitano 8 Years Ago Maybe I found the error: I must create a service module ONLY for the external tables.What I'm doing was just to add the external entity inside an existing service.xml file. Please sign in to reply. Reply as... Cancel David H Nebinger Marco Napolitano 8 Years Ago Yeah, I did include a note about that, you need a separate SB implementation for each database that you're going to. Please sign in to reply. Reply as... Cancel Marco Napolitano David H Nebinger 8 Years Ago Yes, I read that note but I didn't understand that the SB implementation must be completely separate from everything else.Thanks! Please sign in to reply. Reply as... Cancel
Marco Napolitano Marco Napolitano 8 Years Ago Maybe I found the error: I must create a service module ONLY for the external tables.What I'm doing was just to add the external entity inside an existing service.xml file. Please sign in to reply. Reply as... Cancel David H Nebinger Marco Napolitano 8 Years Ago Yeah, I did include a note about that, you need a separate SB implementation for each database that you're going to. Please sign in to reply. Reply as... Cancel Marco Napolitano David H Nebinger 8 Years Ago Yes, I read that note but I didn't understand that the SB implementation must be completely separate from everything else.Thanks! Please sign in to reply. Reply as... Cancel
David H Nebinger Marco Napolitano 8 Years Ago Yeah, I did include a note about that, you need a separate SB implementation for each database that you're going to. Please sign in to reply. Reply as... Cancel Marco Napolitano David H Nebinger 8 Years Ago Yes, I read that note but I didn't understand that the SB implementation must be completely separate from everything else.Thanks! Please sign in to reply. Reply as... Cancel
Marco Napolitano David H Nebinger 8 Years Ago Yes, I read that note but I didn't understand that the SB implementation must be completely separate from everything else.Thanks! Please sign in to reply. Reply as... Cancel
Eloy Castro 7 Years Ago To create the project, blade:create -t servicebuilder -p com.liferay.example.servicebuilder.extdb sb-extdbIt's not worknig, now must use:blade create -t service-builder -p com.liferay.example.servicebuilder.extdb sb-extdb Please sign in to reply. Reply as... Cancel
Camilo Silva 6 Years Ago Hello David, Just wanted to thank you for such great tutorial. I was able to set this up using a Maven based project using SQL Server on Liferay CE 7.0.4. I am very interested in learning more about the Services event hooks and all their capabilities. Specifically, I want to know the magic behind identifying how to call post events on Apps from the Marketplace such as the the Liferay's Web Form or SmartForms. I am fairly new to the Liferay development and I am not sure if Service events or Workflows would be the easier path to listen for events within Liferay. Any hints, advice, or link to one of your tutorials somewhere would be very beneficial. Thanks again! Camilo Silva. Please sign in to reply. Reply as... Cancel
Camilo Silva 6 Years Ago Hello David, Just wanted to thank you for such great tutorial. I was able to set this up using a Maven based project using SQL Server on Liferay CE 7.0.4. I am very interested in learning more about the Services event hooks and all their capabilities. Specifically, I want to know the magic behind identifying how to call post events on Apps from the Marketplace such as the the Liferay's Web Form or SmartForms. I am fairly new to the Liferay development and I am not sure if Service events or Workflows would be the easier path to listen for events within Liferay. Any hints, advice, or link to one of your tutorials somewhere would be very beneficial. Thanks again! Camilo Silva. Please sign in to reply. Reply as... Cancel
Andoni Pérez 6 Years Ago Hi David. Firstly, just wanna say that I really appreciate all your contributions to the community ;D The point is that we are migrating from 6.1 to 7.0 and are stuck in an old Servicebuilder portlet that uses db2 as his database. As it seems, you need to configure the sessionFactory for this "Out of the box" cases in which use enterprise databases. ¿Is there an example that defines this sessionFactory and transactionManager for this kinds of databases (db2 in articular)? Please sign in to reply. Reply as... Cancel David H Nebinger Andoni Pérez 6 Years Ago Unfortunately there is no SB support for enterprise databases in Liferay CE 7.0. However, there is a project where a community member has added support back in: https://www.dontesta.it/en/2016/04/13/liferay-7-ce-how-to-add-support-for-oracle-db/ Although Antonio has only tackled oracle, I think you can use it as a template for DB2 support. If you can enable the SB DB2 support, then this post can help you get access to the external database. I try to avoid recommending direct Hibernate and/or JPA use because it can be difficult getting everything right, especially in OSGi w/ the various class loaders in play... Please sign in to reply. Reply as... Cancel Andoni Pérez David H Nebinger 6 Years Ago Thanks for the quick response David. We already tried that .jar and the db2 datasource seems to work fine. Our problem is with the session factory config files in the "spring" directory of the service proyect. The same configuration in the ext-db-spring.xml does not work in L7 since SessionFactoryImpl has change. The classic: <bean id="externalHibernateSessionFactory" class="com.liferay.portal.spring.hibernate.PortletHibernateConfiguration" lazy-init="true"> <property name="dataSource" ref="externalDataSource" /> </bean> <bean id="externalSessionFactory" class="com.liferay.portal.dao.orm.hibernate.SessionFactoryImpl" lazy-init="true"> <property name="sessionFactoryImplementor" ref="externalHibernateSessionFactory" /> </bean> does not work anymore since it is given a conversion type error: Failed to convert property value of type [com.liferay.portal.dao.orm.hibernate.SessionFactoryImpl] to required type [org.hibernate.SessionFactory] Im looking for any example of this "externalSessionFactory" definition but i am not able to find any. Please sign in to reply. Reply as... Cancel
David H Nebinger Andoni Pérez 6 Years Ago Unfortunately there is no SB support for enterprise databases in Liferay CE 7.0. However, there is a project where a community member has added support back in: https://www.dontesta.it/en/2016/04/13/liferay-7-ce-how-to-add-support-for-oracle-db/ Although Antonio has only tackled oracle, I think you can use it as a template for DB2 support. If you can enable the SB DB2 support, then this post can help you get access to the external database. I try to avoid recommending direct Hibernate and/or JPA use because it can be difficult getting everything right, especially in OSGi w/ the various class loaders in play... Please sign in to reply. Reply as... Cancel Andoni Pérez David H Nebinger 6 Years Ago Thanks for the quick response David. We already tried that .jar and the db2 datasource seems to work fine. Our problem is with the session factory config files in the "spring" directory of the service proyect. The same configuration in the ext-db-spring.xml does not work in L7 since SessionFactoryImpl has change. The classic: <bean id="externalHibernateSessionFactory" class="com.liferay.portal.spring.hibernate.PortletHibernateConfiguration" lazy-init="true"> <property name="dataSource" ref="externalDataSource" /> </bean> <bean id="externalSessionFactory" class="com.liferay.portal.dao.orm.hibernate.SessionFactoryImpl" lazy-init="true"> <property name="sessionFactoryImplementor" ref="externalHibernateSessionFactory" /> </bean> does not work anymore since it is given a conversion type error: Failed to convert property value of type [com.liferay.portal.dao.orm.hibernate.SessionFactoryImpl] to required type [org.hibernate.SessionFactory] Im looking for any example of this "externalSessionFactory" definition but i am not able to find any. Please sign in to reply. Reply as... Cancel
Andoni Pérez David H Nebinger 6 Years Ago Thanks for the quick response David. We already tried that .jar and the db2 datasource seems to work fine. Our problem is with the session factory config files in the "spring" directory of the service proyect. The same configuration in the ext-db-spring.xml does not work in L7 since SessionFactoryImpl has change. The classic: <bean id="externalHibernateSessionFactory" class="com.liferay.portal.spring.hibernate.PortletHibernateConfiguration" lazy-init="true"> <property name="dataSource" ref="externalDataSource" /> </bean> <bean id="externalSessionFactory" class="com.liferay.portal.dao.orm.hibernate.SessionFactoryImpl" lazy-init="true"> <property name="sessionFactoryImplementor" ref="externalHibernateSessionFactory" /> </bean> does not work anymore since it is given a conversion type error: Failed to convert property value of type [com.liferay.portal.dao.orm.hibernate.SessionFactoryImpl] to required type [org.hibernate.SessionFactory] Im looking for any example of this "externalSessionFactory" definition but i am not able to find any. Please sign in to reply. Reply as... Cancel
Christophe Cariou 6 Years Ago Hi David, we have trouble with a service module with external datasource (JNDI) that worked fine in 7.1.0 GA1 and failed in 7.1.1 GA2 : Despite my configuration, the service is using the INTERNAL datasource (lportal database) instead of the external one. I followed the official documentation (https://dev.liferay.com/fr/develop/reference/-/knowledge_base/7-1/service-builder-application-using-external-database-via-jndi ) and raised a jira issue (https://issues.liferay.com/browse/LPS-88444 ) . I'm not the only one with that trouble (https://community.liferay.com/forums/-/message_boards/message/111742415 ). I suspect a ClassLoader trouble as between GA1 and GA2 there was a deprecation and replacement of ClassLoaderUtil by PortalClassLoaderUtil. Do you have any clue or advice for us please ? Christophe Please sign in to reply. Reply as... Cancel
Scott Lee 6 Years Ago Thanks again for writing up these blog posts! By any chance, do you happen to have the hypersonic script file that you used? Please sign in to reply. Reply as... Cancel David H Nebinger Scott Lee 6 Years Ago There's no script file, just the "CREATE MEMORY TABLE..." above... Please sign in to reply. Reply as... Cancel Scott Lee David H Nebinger 6 Years Ago I think I had messed up the code in my external hsql script file, still not sure what I did wrong, in the end, I downloaded a GUI which generated the script file and everything works now. Btw, in case anyone is trying this in 7.1 DXP, this is currently broken (from fixpack-3 to the current fixpack-6). I made a ticket for this, but in the meantime, you can test out your code with fixpack 1 or 2, or just plain GA1. Please sign in to reply. Reply as... Cancel
David H Nebinger Scott Lee 6 Years Ago There's no script file, just the "CREATE MEMORY TABLE..." above... Please sign in to reply. Reply as... Cancel Scott Lee David H Nebinger 6 Years Ago I think I had messed up the code in my external hsql script file, still not sure what I did wrong, in the end, I downloaded a GUI which generated the script file and everything works now. Btw, in case anyone is trying this in 7.1 DXP, this is currently broken (from fixpack-3 to the current fixpack-6). I made a ticket for this, but in the meantime, you can test out your code with fixpack 1 or 2, or just plain GA1. Please sign in to reply. Reply as... Cancel
Scott Lee David H Nebinger 6 Years Ago I think I had messed up the code in my external hsql script file, still not sure what I did wrong, in the end, I downloaded a GUI which generated the script file and everything works now. Btw, in case anyone is trying this in 7.1 DXP, this is currently broken (from fixpack-3 to the current fixpack-6). I made a ticket for this, but in the meantime, you can test out your code with fixpack 1 or 2, or just plain GA1. Please sign in to reply. Reply as... Cancel
Nirav Prajapati 6 Years Ago Hi David, I am using Liferay 7.1 CE GA2. I have created two modules project in a single workspace project. One for a database (service builder) and second for consuming those database things. Now If I need to use that service builder in same works[ace I need to write compile project (":modules:FirstModuleDatabase:FirstModuleDatabase-api") line in build.gradle. But if I want to use same service builder in another workspace project what I should have to do? Like in 6.2, If I want to use any service builder generated tables in any portlet I copy jar file of that service builder from Lib file and past in required portlet's Lib folder and I am able to use all classes and interfaces of service builder in that portlet. Please let me know How I can achieve it in Liferay 7.1 CE GA2 Please sign in to reply. Reply as... Cancel
Sacha Piccardi 5 Years Ago Hi David, thank you for your article. I tried to follow your instructions and the ones written in the subsequent articles, but it seems something has changed in the 7.2-ga1 Liferay's version. The articles that I've read: https://portal.liferay.dev/docs/7-1/tutorials/-/knowledge_base/t/connecting-service-builder-to-external-databases https://portal.liferay.dev/docs/7-1/reference/-/knowledge_base/r/service-builder-application-using-external-database-via-jdbc It seems that service builder is totally ignoring the ext-spring.xml file. Furthermore when i try to put the spring-module.xml file under the META-INF/spring path the service builder removes it. Can you help me, please? Thanks in advance. Please sign in to reply. Reply as... Cancel Antonio Musarra Sacha Piccardi 5 Years Ago Hi Sacha. I don't know if you have solved your problem in the meantime. I updated David's project to version 7.1 of Liferay and it works correctly. Try perhaps to see the project https://github.com/amusarra/sb-extdb Please sign in to reply. Reply as... Cancel Antonio Musarra Sacha Piccardi 5 Years Ago Hi Sacha. I don't know if you have solved your problem in the meantime. I just updated David's project to version 7.2 of Liferay and it works correctly. Try perhaps to see the project https://github.com/amusarra/sb-extdb Please sign in to reply. Reply as... Cancel
Antonio Musarra Sacha Piccardi 5 Years Ago Hi Sacha. I don't know if you have solved your problem in the meantime. I updated David's project to version 7.1 of Liferay and it works correctly. Try perhaps to see the project https://github.com/amusarra/sb-extdb Please sign in to reply. Reply as... Cancel
Antonio Musarra Sacha Piccardi 5 Years Ago Hi Sacha. I don't know if you have solved your problem in the meantime. I just updated David's project to version 7.2 of Liferay and it works correctly. Try perhaps to see the project https://github.com/amusarra/sb-extdb Please sign in to reply. Reply as... Cancel
Antonio Musarra 5 Years Ago Hi, David. I forked your repository (https://github.com/amusarra/sb-extdb) and updated for Liferay 7.1 GA3. I did the update to respond to a reader of my blog who encountered some difficulties on Liferay 7.1 and SQL Server as an external database. Thanks for your work. Please sign in to reply. Reply as... Cancel Pankaj Kumar Antonio Musarra 5 Years Ago Hi David, In Liferay DXP 7.2 i am trying to connect external DB thorough Hibernate session factory. But getting below error. Cannot convert value of type 'org.hibernate.impl.SessionFactoryImpl' to required type 'com.liferay.portal.kernel.dao.orm.SessionFactory' for property 'sessionFactory': no matching editors or conversion strategy found Here is my config. <bean class="com.liferay.portal.spring.hibernate.PortalHibernateConfiguration" id="customSessionFactory"> <property name="dataSource" ref="liferayDataSource" /> </bean> <bean class="com.liferay.portal.spring.transaction.TransactionManagerFactory" factory-method="createTransactionManager" id="crmTransaction"> <constructor-arg ref="liferayDataSource" /> <constructor-arg ref="customSessionFactory" /> </bean> Service.xml<entity local-service="true" name="Foo" remote-service="true" uuid="true" data-source="extDataSource" session-factory="customSessionFactory" tx-manager="crmTransaction" > Is there any example or documentation for this how we can open hibernate session factory in DXP 7.2 Please sign in to reply. Reply as... Cancel Antonio Musarra Pankaj Kumar 5 Years Ago Hi Pakaj. You could see my fork for Liferay 7.2 on my GitHub repository http://bit.ly/2BwEyM4 Please sign in to reply. Reply as... Cancel Pankaj Kumar Antonio Musarra 5 Years Ago Thanks Antonio for response. I am able to get data source and able to connect with external db.My problem is with session configuration done in ext-spring.xml file.As I am not able to get the session factory object using hibernate session. Please sign in to reply. Reply as... Cancel
Pankaj Kumar Antonio Musarra 5 Years Ago Hi David, In Liferay DXP 7.2 i am trying to connect external DB thorough Hibernate session factory. But getting below error. Cannot convert value of type 'org.hibernate.impl.SessionFactoryImpl' to required type 'com.liferay.portal.kernel.dao.orm.SessionFactory' for property 'sessionFactory': no matching editors or conversion strategy found Here is my config. <bean class="com.liferay.portal.spring.hibernate.PortalHibernateConfiguration" id="customSessionFactory"> <property name="dataSource" ref="liferayDataSource" /> </bean> <bean class="com.liferay.portal.spring.transaction.TransactionManagerFactory" factory-method="createTransactionManager" id="crmTransaction"> <constructor-arg ref="liferayDataSource" /> <constructor-arg ref="customSessionFactory" /> </bean> Service.xml<entity local-service="true" name="Foo" remote-service="true" uuid="true" data-source="extDataSource" session-factory="customSessionFactory" tx-manager="crmTransaction" > Is there any example or documentation for this how we can open hibernate session factory in DXP 7.2 Please sign in to reply. Reply as... Cancel Antonio Musarra Pankaj Kumar 5 Years Ago Hi Pakaj. You could see my fork for Liferay 7.2 on my GitHub repository http://bit.ly/2BwEyM4 Please sign in to reply. Reply as... Cancel Pankaj Kumar Antonio Musarra 5 Years Ago Thanks Antonio for response. I am able to get data source and able to connect with external db.My problem is with session configuration done in ext-spring.xml file.As I am not able to get the session factory object using hibernate session. Please sign in to reply. Reply as... Cancel
Antonio Musarra Pankaj Kumar 5 Years Ago Hi Pakaj. You could see my fork for Liferay 7.2 on my GitHub repository http://bit.ly/2BwEyM4 Please sign in to reply. Reply as... Cancel Pankaj Kumar Antonio Musarra 5 Years Ago Thanks Antonio for response. I am able to get data source and able to connect with external db.My problem is with session configuration done in ext-spring.xml file.As I am not able to get the session factory object using hibernate session. Please sign in to reply. Reply as... Cancel
Pankaj Kumar Antonio Musarra 5 Years Ago Thanks Antonio for response. I am able to get data source and able to connect with external db.My problem is with session configuration done in ext-spring.xml file.As I am not able to get the session factory object using hibernate session. Please sign in to reply. Reply as... Cancel
Antonio Musarra 4 Years Ago - Edited To inform you that I have updated the project to version 7.3 of Liferay https://github.com/amusarra/sb-extdb Please sign in to reply. Reply as... Cancel