I'm using hibernate 4 version. Trying to persist an entity using the following code:
if(surveyUserRequestTO!=null){
surveyUser = new SurveyUser();
surveyUser.setAdmin(surveyUserRequestTO.getAdmin());
surveyOrganization = getEntityManager().find(SurveyOrg.class, surveyUserRequestTO.getOrganizationID());
if(surveyOrganization !=null){
surveyUser.setSurveyOrg(surveyOrganization);
}else{
return null;
}
surveyUser.setUserName(surveyUserRequestTO.getUserName());
surveyUser.setUserSurveyID(surveyUserRequestTO.getSurveyUserID());
getEntityManager().persist(surveyUser);
And I'm getting following exception:-
JBAS014134: EJB Invocation failed on component NewUserDataProvider for
method public
com.alt.survey.user.transport.output.SurveyUserResponseTO
com.alt.survey.user.dataprovider.NewUserDataProvider.createNewUser(com.alt.survey.user.transport.input.SurveyUserRequestTO)
throws java.lang.Exception: javax.ejb.EJBException: Transaction
present on server in Never call (EJB3 13.6.2.6)
What I believe it's something related to TransactionAttribute property. Any possible help will be highly appreciable.
- There is no default transaction attribute for an EJB. - The deployer must specify a value for the transaction attribute for the methods that have container managed transactions.
Never Attribute If the client is running within a transaction and invokes the enterprise bean's method, the container throws a RemoteException. If the client is not associated with a transaction, the container does not start a new transaction before running the method.
You have NEVER transaction attribute somewhere in your code (see your stacktrace). You can not start transaction inside EJB method with NEVER transaction attribute
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With