Hi,
I was in the making of a process and I figured out I need to add some custom queries to my Business Data Model (BDM), I had already created some Business Variables and now when I try to run it gives me an error saying that the Business Variables originally created are not managed by the current version of the BDM.
I tried to delete the Business Variables and create them again but didn’t solve the problem.
I will share two print screens and hopefully someone can help me. I’m using Bonita Studio Community Edition 7.8.3
Print screen of the process and Business Variables:
Print screen of the error:
Thank you.
I found your problem.
In your bdm definition, you were created a custom query named “findByIdOfList”. In this query you can’t use
“c.listaCandidaturas_PId” variable. It’s against JPQL sytax. You can only use your variables. Check engine logs after you deploy bdm then you can see the error. Because of this error your bdm corrupted and studio can’t find your tables.
please check JPQL documentation
Hi nuno.pinho_1389852,
I have not been able to reproduce the behaviour you describe. Here is what I do (all from within the Studio):
- Define a com.company.model.TestBO business object in my Business Data Model.
- Create a simple new diagram with a business variable myBOVariable of type com.company.model.TestBO.
→ The process contains a contract “added from data”, so that the data gathered in the process’ instantiation form initialises the myBOVariable variable.
- Run the process clicking on the “Play” button in the Studio.
- Add a new custom query to my com.company.model.TestBO business object’s definition.
→ Click on ‘OK’ in the “Warning: Impact of changes” pop-up window.
→ Click on ‘OK’ in the “Business Data Model deployed” pop-up window.
- Re-run the process clicking on the “Play” button in the Studio.
So:
- Are you sure the BDM was deployed again following your custom queries’ addition? Could you deploy again by doing: ‘Development > Business Data Model > Define… > Finish’?
- How are you re-running your process after you add the custom queries to your BDM? If you re-run it from the Studio, the process should be redeployed and therefore your business variables should be in accordance with your latest BDM definition.
Else, you may share your .bos through a Google Drive for example, and I will have a look at it.
Regards,
Unai
Hi unai.gaston.caminos,
To answer your questions:
- I already tried a couple of times deploying it and it always says deployment successful
- Yes I always re-run from studio
I will send the link for the .bos file, if you can help me with this problem I will be very garateful.
https://drive.google.com/open?id=1oM8GGdLgou_xj-hNemdh9hBTAGDIa1wD
Thank you,
Nuno Pinho
Well seen, msakirkutlu_1359205.
Indeed, when the BDM is deployed, we get some errors:
2019-04-09 16:52:23.557 +0200 ERROR: org.hibernate.internal.SessionFactoryImpl HHH000177: Error in named query: ListaCandidaturas.findLastPersistenceId
org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: LIMIT near line 3, column 29 [SELECT l.persistenceId
FROM com.company.model.ListaCandidaturas l
ORDER BY persistenceId DESC LIMIT 1]
...
=> LIMIT is not a valid token in JPQL (see for example this article).
2019-04-09 16:52:23.558 +0200 ERROR: org.hibernate.internal.SessionFactoryImpl HHH000177: Error in named query: Candidatura.findByIdOfList
org.hibernate.QueryException: could not resolve property: listaCandidaturas_PId of: com.company.model.Candidatura [SELECT c
FROM com.company.model.Candidatura c
WHERE c.listaCandidaturas_PId = :listaId
ORDER BY c.persistenceId ASC]
...
Caused by: org.hibernate.QueryException: could not resolve property: listaCandidaturas_PId of: com.company.model.Candidatura
...
=> there is no such attribute listaCandidaturas_Pld in your com.company.model.Candidatura business object.
I suggest you read carefully the documentation section on BDM .
Regards,
Unai
Thank you!
I will pay more atention to the log file, i didn’t know we couldn’t use LIMIT in JPQL.
It is a bit stupid the second error, since it is an auto-created attribute in the database, we should be able to use, by the same logic we shouldn’t be able to use, in queries, the persistenceId, because it is not defined in my attributes, and we can use it. Or am I missing something?
Thank you,
Nuno Pinho
Hi nuno.pinho_138985,
Excuse me for coming back on this so belatedly.
In any case, what you say makes sense indeed. I believe the problem here comes from the fact that the BDM deploys your objects in this order:
- object Candidatura
create persistenceId
create all explicitely defined attributes
create queries
- object ListaCandidaturas
create persistenceId
create all explicitely defined attributes
create listaCandidaturas_PId in Candidatura table
create queries
Hence, when the queries of the object Candidatura are created, the attribute listaCandidaturas_PId does not exist yet.
You may open a bug report in ( BBPMC ) to raise this issue, providing the example BDM and necessary steps to reproduce it.
Regards,
Unai