-
1. Re: hibernate.cfg.xml not found (JBPM5 / Install.demo)
imadt Aug 13, 2012 4:34 PM (in response to imadt)Do any one can help me !!?
I spent all the day trying to get Hibernate configured with Jboss7 but no luck.
please need ur helo here. Thanks
-
2. Re: hibernate.cfg.xml not found (JBPM5 / Install.demo)
calca Aug 13, 2012 4:49 PM (in response to imadt)1 of 1 people found this helpfulWhere are you runing this query? In your app? I think that as jBPM uses JPA you don't use an hibernate.cfg.xml file, but a persistence.xml.
Regards,
Demian
-
3. Re: hibernate.cfg.xml not found (JBPM5 / Install.demo)
imadt Aug 13, 2012 5:00 PM (in response to calca)Thank you so much Demian for your reply.
i can see that jBPM use the JPA but after i run my code it's giving me :
org.hibernate.HibernateException: /hibernate.cfg.xml not found
at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170)
....
Can you give me a link where i can found how to use jBPM with Jboss/Hibernate ?
-
4. Re: hibernate.cfg.xml not found (JBPM5 / Install.demo)
calca Aug 13, 2012 6:02 PM (in response to imadt)Well, I still don't understand what you are trying to achieve? What do you want to query?
To create a Query using JPA, you must create an EntityManager from one of the persistence units you have in persistence.xml.
EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");
and then create an entity manager that will let you create a query.
But again, it would be good to know what you are trying to do in order to help you.
Thanks
Demian
-
5. Re: hibernate.cfg.xml not found (JBPM5 / Install.demo)
imadt Aug 13, 2012 7:01 PM (in response to calca)Demain,
I have Jbpm5 with jBoss 7 well configured, right now i'm trying to excute a query that will Insert "a simple row" in my database table "users".
Here is my code with JPA :
EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");
EntityManager em = emf.createEntityManager();
Query query = em.createQuery("SELECT c FROM users c");
List results = query.getResultList();
System.out.println(results);
When i run this i get this error :
java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: users is not mapped [SELECT c FROM users c]
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:601)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:96)
at com.sample.ProcessTest.testProcess(ProcessTest.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
...
I'm confused now i'm Using JPA but i get org.hibernate.hql.ast.QuerySyntaxException: users is not mapped Error.
Hope that thinsg get clear for you now.
And i really appreciate your help. Thank you in advance.
-
6. Re: hibernate.cfg.xml not found (JBPM5 / Install.demo)
calca Aug 13, 2012 7:17 PM (in response to imadt)Well, there it says that Users is not mapped.
If you want to query the users from task database (https://github.com/droolsjbpm/jbpm/blob/master/jbpm-human-task/jbpm-human-task-core/src/main/java/org/jbpm/task/User.java)
you can make "From User"
and when creating the EntityManagerFactory, the persistence unit name is "org.jbpm.task"
Jbpm uses two persistence units (you can check it in file persistence.xml, it should look like this https://github.com/calcacuervo/JBPM5-Samples/blob/master/human-tasks/src/test/resources/META-INF/persistence.xml) One is for human tasks persistence, and the other for jbpm runtime entities.
Hope this helps,
Demian