[jboss-user] [JBoss Seam] - Identity check during hibernate operaiotn in application com

rpochet do-not-reply at jboss.com
Wed Aug 22 15:09:49 EDT 2007


Hi,

I'm trying to execute database insert during creation of an application scope component

  | @Scope(value=ScopeType.APPLICATION)
  | @Name("initialisation")
  | @Startup(depends="hibernateSessionFactory")
  | public class Initialisation
  | {
  |     @Logger
  |     private Log logger = null;
  |     
  |     @In
  |     private Session homeDatabase = null;
  |     
  |     @Create
  |     @CreateProcess(definition="discoveryAll")
  |     public void init()
  |     {
  |          homeDatabase.save(...);
  |     }
  |     {

but I got a 
java.lang.IllegalStateException: No active session context
  | 	at org.jboss.seam.security.Identity.instance(Identity.java:157)
  | 	at org.jboss.seam.security.HibernateSecurityInterceptor.onSave(HibernateSecurityInterceptor.java:73)
  | 	at org.hibernate.event.def.AbstractSaveEventListener.substituteValuesIfNecessary(AbstractSaveEventListener.java:394)
  | 	at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:270)
  | 	at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
  | 	at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
  | 	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
  | 	at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
  | 	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
  | 	at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
  | 	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
  | 	at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)
  | 	at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
  | 	at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)
  | 	at org.hibernate.search.impl.FullTextSessionImpl.save(FullTextSessionImpl.java:439)
  | 	at org.jboss.seam.persistence.HibernateSessionProxy.save(HibernateSessionProxy.java:335)
  | 

because there is no identity currently defined.
By setting 
Identity.setSecurityEnabled(false);
it works but this disabled all security check.

Any idea on how to handle such feature?

Thanks,

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077019#4077019

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077019



More information about the jboss-user mailing list