'Where can I find the database that I am trying to access with Hibernate?
I am browsing through a code that is not mine and I would like to manually change a few pieces of data within the database of the application. The code is using hibernate to handle its communication with the db but I cannot figure out exactly where the db related information (table names, accesspoint, etc.) is mentioned. I have tried to find more by diving into the class tree but always end up finding the hibernate black box classes (that I cannot understand even by using decompilers).
Basically the part that seems to be the closest to my point is this one :
getElements(String businessKey, String businessKeyBis, ProcessType processType) {
Session session = getSession();
BusinessProcessInstance result = null;
//Hibernate creates a criteria
Criteria criteriaQuery = session.createCriteria(BusinessProcessInstance.class)
.add(Restrictions.in("state", new ProcessState[]{ProcessState.RUNNING, ProcessState.NEW}))
.add(Restrictions.eq("businessKey", businessKey))
.add(Restrictions.eq("processType", processType))
.addOrder(Order.desc("id"));
if (null != businessKeyBis) {
criteriaQuery.add(Restrictions.eq("businessKeyBis", businessKeyBis));
}
@SuppressWarnings("unchecked")
//Then at this point it uses the 'list' method to question the database
List<BusinessProcessInstance> bpiList = criteriaQuery.list();
if (bpiList.size() > 0) {
result = bpiList.get(0);
}
return result;
Is there an hibernate expert around who could help me figure out if there is some kind of 'configuration' document where we could mention all the relevant parameters for hibernate ? Or if there is anything that I should be aware of which could possibly help me comprehend the way the framework acts ?
Thank you !
Solution 1:[1]
The issue has been solved thanks to what Bohemian pinpointed in the comments :
For anybody who would have ended up here after facing the same interrogations as I did, just track down your code until you find some classes with various properties which are self explanatory and can be associated with database fields. When using Spring this is even easier, just look for an @Entity annotated class with @Table and @Column annotations and this is what you are looking for :D .
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |