-
1. Re: JBoss5.1.0 + JPA = Object not persists
wdfink Oct 4, 2011 2:07 AM (in response to amitajmani1)Why you put hibernate-jpa-2.0 jar into the lib directory. The JBoss supports hibernate and jpa (maybe not 2.0) and it might conflict with it.
Do you must use jpa2.0??
Work sometimes sounds to me like a transaction rollback ... do you see any in the logfiles?
Why and what do you use instead of 6.0 when it works with it?
-
2. Re: JBoss5.1.0 + JPA = Object not persists
amitajmani1 Oct 4, 2011 9:57 AM (in response to wdfink)Why you put hibernate-jpa-2.0 jar into the lib directory. The JBoss supports hibernate and jpa (maybe not 2.0) and it might conflict with it.
Do you must use jpa2.0??
- > Initially i thought that JPA annotations are only supported in Jpa 2.0 hence i put that jar in my lib folder. now i have removed it and annotations works..
Work sometimes sounds to me like a transaction rollback ... do you see any in the logfiles?
- > No i didn't get any rollback exceptions......
Why and what do you use instead of 6.0 when it works with it?
- > we have planned to setup JBoss5.1.0 enterprise edition on production server since Jboss does not give production support on version 6.0 or later...
-
3. Re: JBoss5.1.0 + JPA = Object not persists
wdfink Oct 4, 2011 11:22 AM (in response to amitajmani1)1 of 1 people found this helpfulI have a running implementation with JBoss 5.1.1 EAP (supported) and also a 5.1 (community) without changes to hibernate running.
A standard JPA entity with annotations works without problems.
You might set 'org.hibernate' to TRACE to see what happen in case of lost 'persist'
-
4. Re: JBoss5.1.0 + JPA = Object not persists
amitajmani1 Oct 4, 2011 6:17 PM (in response to wdfink)After setting the org.hibernate to TRACE in logger i found this :
2011-10-04 18:10:23,559 TRACE [org.hibernate.jdbc.JDBCContext] (http-127.0.0.1-8080-1) TransactionFactory reported no active transaction; Synchronization not registered
how to fix this .......i have already set @TransactionManagement(TransactionManagementType.CONTAINER) on my stateless ejb.
-
5. Re: JBoss5.1.0 + JPA = Object not persists
amitajmani1 Oct 4, 2011 10:36 PM (in response to amitajmani1)One thing i have noticed that the moment i boot my server up and deploy the application , the first transaction completed successfully, and then after wards it gives messages like "TransactionFactory reported no active transaction; Synchronization not registered".
any idea where i am making mistake..... or how to use CMT over Stateless EJB3.0 with JBOSS 5.1.0GA.......?
-
6. Re: JBoss5.1.0 + JPA = Object not persists
wdfink Oct 5, 2011 2:36 AM (in response to amitajmani1)How do you annotate your SLSB?
Where do you add @TransactionAttribute? At class or method level and what do you use REQUIRED, SUPPORTS?
Do you use only one SLSB or a chain of it?
-
7. Re: JBoss5.1.0 + JPA = Object not persists
amitajmani1 Oct 5, 2011 8:11 AM (in response to wdfink)How do you annotate your SLSB?
Answer :
here is my SLSB :
public interface UserService {
public List<User> getRegisteredUsers();
public void registerUser(User user);
}
// this is a simple POJO class containing business logic
private UserServiceCoreImpl coreService;
public UserServiceImpl(){
coreService = new UserServiceCoreImpl();
}
publicList<User> getRegisteredUsers(){
coreService.getRegisteredUsers();
....
}
// performs a database INSERT operation
public void registerUser(User user){
coreService.registerUser(user);
}
}
Where do you add @TransactionAttribute? At class or method level and what do you use REQUIRED, SUPPORTS?
Answer : At the class level as you can see from above code snippet.
We are using a single SLSB which invokes a POJO class containing the business logic and which also performs the database operation.
public class UserServiceImpl implements UserService {
@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
@Remote
-
8. Re: JBoss5.1.0 + JPA = Object not persists
wdfink Oct 5, 2011 8:45 AM (in response to amitajmani1)your post it a bit messed up, isn't it
but as I can see there is no '@TransactionAttribute(TransactionAttributeType.REQUIRED)' annotation neither on class nor on method-level.
It should be the default but I don't see your complete code.
You might active logging on 'com.arjuna.ats' to see the Tx stuff.
-
9. Re: JBoss5.1.0 + JPA = Object not persists
amitajmani1 Oct 5, 2011 9:39 AM (in response to wdfink)Actually i tried to answer line by line....
ok , here my code
@Remote
public interface UserService {
public List<User> getRegisteredUsers(); public void registerUser(User user);
@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
public class UserServiceImpl implements UserService {
private UserServiceCoreImpl userService;
public UserServiceImpl(){
userService = new UserServiceCoreImpl();
}
public List<User> getRegisteredUsers(){
return userService.getRegisteredUsers();
}
public void registerUser(User user){
userService.registerUser(user);
}
}
public class UserServiceCoreImpl implements UserService{
private GenericDao dao;
public UserServiceCoreImpl(){
dao = new GenericDaoImpl();
}
public GenericDao getDao(){
return dao;
}
public void registerUser(User user){
getDao().persist(user);
}
...........................
.............................
}
}
-
10. Re: JBoss5.1.0 + JPA = Object not persists
amitajmani1 Oct 5, 2011 2:04 PM (in response to amitajmani1)I tried annotation @TransactionAttribute(TransactionAttributeType.REQUIRED) at method level, but no success. i have also attached the logs .....
may be the attached logs help you to point out the problem area.......
-
serverlog.txt.zip 45.3 KB
-
-
11. Re: JBoss5.1.0 + JPA = Object not persists
amitajmani1 Oct 11, 2011 3:47 PM (in response to amitajmani1)Hi,
I found the solution .
just need to put these properties in the persistence.xml file and it all works fine..
<code>
<persistence-unit name="jdbcService" transaction-type="JTA">
........
<property name="jboss.entity.manager.jndi.name" value="java:/jdbcService"></property>
</code>
thanks for all your kind support.....:)
Amit