Save bdm entities using custom connector
I am willing to create a custom connector to save the files to the server location. after saving that I want to save that server location to bdm table. This is my code to access the bdm DAO object.
documentMappingDAO = (new BusinessObjectDAOFactory()).createDAO(apiSession, DocumentMappingDAO.class);
But this is giving the class not found error.
org.bonitasoft.engine.bdm.BusinessObjectDaoCreationException: java.lang.ClassNotFoundException: com.company.model2.DocumentMappingDAOImpl
In a connector, you should not create or update a BDM. It's not possible to do that because when Bonita calls the connector code, it doesn't open a database transaction.
Secondly, a connector should be generic, so not directly mapped to a BDM variable. The association is made in the process, where you declare your Process Variable.
Your connector must provide the data (in a HashMap, or a List), and then, using the operation out of the connector, you can update your BDM variable. In the script attached to the operation, then you have all the BDM accessors.
This is the spirit of the product. Saying that, if you want to manipulate the BDM table INSIDE a connector, you don't have the object. You may have a look in the JAR file generated by the studio to creates the object, but then you have to associate this JAR file in the connector implementation. And when the BDM change, this jar file changes => You are supposed to create a new version of your connector...
So, from the integration point of view, I would go to a direct SQL Update but keep in mind this is completely discouraged, and the principle is to used the operation output of the connector.