[Persistence, JBoss/CMP, Hibernate, Database] - Not binding factory to JNDI, no JNDI name configured
by Jihnd
hello,
i cant seem to get my jndi name bound, i've read in various searches that i need to adjust a hibernate xml file, but my jboss (4.0.5) does not have a hibernate folder, i'm using ejb3 with annotations and oracle xe, win xp sp2
this is the message i'm getting, and my console says everything is bound, so i'm a little stumped!
anonymous wrote : 2007-08-23 17:51:42,453 DEBUG [org.hibernate.loader.entity.EntityLoader] Static select for entity com.AVman.domain.Audiorec: select audiorec0_.Audiorec_alias as Audiorec1_8_0_, audiorec0_.Barcode_audiorec as Barcode2_8_0_, audiorec0_.Serial_audiorec as Serial3_8_0_, audiorec0_.Media_audiorec as Media4_8_0_, audiorec0_.Formats_audiorec as Formats5_8_0_ from Audiorec audiorec0_ where audiorec0_.Audiorec_alias=? for update nowait
| 2007-08-23 17:51:42,453 DEBUG [org.hibernate.loader.entity.EntityLoader] Static select for action ACTION_MERGE on entity com.AVman.domain.Audiorec: select audiorec0_.Audiorec_alias as Audiorec1_8_0_, audiorec0_.Barcode_audiorec as Barcode2_8_0_, audiorec0_.Serial_audiorec as Serial3_8_0_, audiorec0_.Media_audiorec as Media4_8_0_, audiorec0_.Formats_audiorec as Formats5_8_0_ from Audiorec audiorec0_ where audiorec0_.Audiorec_alias=?
| 2007-08-23 17:51:42,453 DEBUG [org.hibernate.loader.entity.EntityLoader] Static select for action ACTION_REFRESH on entity com.AVman.domain.Audiorec: select audiorec0_.Audiorec_alias as Audiorec1_8_0_, audiorec0_.Barcode_audiorec as Barcode2_8_0_, audiorec0_.Serial_audiorec as Serial3_8_0_, audiorec0_.Media_audiorec as Media4_8_0_, audiorec0_.Formats_audiorec as Formats5_8_0_ from Audiorec audiorec0_ where audiorec0_.Audiorec_alias=?
| 2007-08-23 17:51:42,453 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] registered: d28c5ac114937836011493a2eef50004 (unnamed)
| 2007-08-23 17:51:42,453 INFO [org.hibernate.impl.SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
| 2007-08-23 17:51:42,453 DEBUG [org.hibernate.impl.SessionFactoryImpl] instantiated session factory
| 2007-08-23 17:51:42,453 DEBUG [org.hibernate.cfg.AnnotationConfiguration] Execute first pass mapping processing
| 2007-08-23 17:51:42,453 DEBUG [org.hibernate.cfg.AnnotationConfiguration] Process hbm files
| 2007-08-23 17:51:42,453 DEBUG [org.hibernate.cfg.AnnotationConfiguration] Process annotated classes
| 2007-08-23 17:51:42,453 DEBUG [org.hibernate.cfg.AnnotationConfiguration] processing manytoone fk mappings
| 2007-08-23 17:51:42,453 DEBUG [org.hibernate.cfg.Configuration] processing extends queue
| 2007-08-23 17:51:42,453 DEBUG [org.hibernate.cfg.Configuration] processing collection mappings
my files:
persistence.xml
<persistence>
| <persistence-unit name="AVmanBean">
| <jta-data-source>java:/OracleDS</jta-data-source>
| <jar-file>c:/AVman.jar</jar-file>
| <class>com.AVman.domain.Audiorec</class>
| <class>com.AVman.Audiorec.AVmanRemote</class>
| <class>com.AVman.Audiorec.AVmanBean</class>
| <properties>
| <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| <property name="jboss.entity.manager.jndi.name" value="java:/AVmanBean"/>
| <property name="jboss.entity.manager.factory.jndi.name" value="java:/AVmanBeanFactory"/>
| </properties>
| </persistence-unit>
| </persistence>
&
anonymous wrote : package com.AVman.domain;
|
| import javax.persistence.*;
|
| @Entity
| @Table(name="Audiorec")
| public class Audiorec implements java.io.Serializable{
| private int Barcode_audiorec;
| private String Audiorec_alias;
| private String Serial_audiorec;
| private String Media_audiorec;
| private String Formats_audiorec;
|
| @Id
| @Column(name="Audiorec_alias")
| public String getAudiorec_alias( ) { return Audiorec_alias; }
| public void setAudiorec_alias(String alias) { this.Audiorec_alias = alias; }
|
| @Column(name="Barcode_audiorec")
| public int getBarcode_audiorec( ) { return Barcode_audiorec; }
| public void setBarcode_audiorec(int barcode) { this.Barcode_audiorec = barcode; }
|
| @Column(name="Serial_audiorec")
| public String getSerial_audiorec( ) { return Serial_audiorec; }
| public void setSerial_audiorec(String serial) { this.Serial_audiorec = serial; }
|
| @Column(name="Media_audiorec")
| public String getMedia_audiorec( ) { return Media_audiorec; }
| public void setMedia_audiorec(String media) { this.Media_audiorec = media; }
|
| @Column(name="Formats_audiorec")
| public String getFormats_audiorec( ) { return Formats_audiorec; }
| public void setFormats_audiorec(String formats) { this.Formats_audiorec = formats; }
|
| }
&
anonymous wrote :
| package com.AVman.Audiorec;
|
| import javax.ejb.Remote;
| import com.AVman.domain.Audiorec;
|
| @Remote
| public interface AVmanRemote {
|
| public void createAudiorec(Audiorec audiorec);
| public Audiorec findAudiorec(String Audiorec_alias);
| }
&
anonymous wrote :
| package com.AVman.Audiorec;
|
| import javax.ejb.Stateless;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
|
| import com.AVman.domain.Audiorec;
|
| @Stateless
| public class AVmanBean implements AVmanRemote{
| @PersistenceContext(unitName="AVmanBean")
| private EntityManager manager;
|
| public void createAudiorec(Audiorec audiorec) {
| manager.persist(audiorec);
| }
|
| public Audiorec findAudiorec(String alias) {
| return manager.find(Audiorec.class, alias);
| }
| }
|
very very much apppreciate any help!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077492#4077492
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077492
18Â years, 8Â months
[JBoss Seam] - Re: Difference between Page and Event scope
by dustismo
Here is how I would explain it, if I get anything wrong anyone is welcome to correct me.
Event scope is essentially stateless, the bean is created for a single action and destroyed when that action is complete.
Page scope maintains its state until the page is rendered. So here is an example that might illustrate it better:
you have a bean with a couple of properties:
| @Scope(PAGE)
| @Name("demoBean")
| ....
| int id;
| String message = "message not set";
|
| public int getId() ...
| public void setId(int id) {
| this.id = id;
| this.message = "ID Is set!";
| }
|
| public String getMessage()
| public void setMessage(String message)
| ....
|
Say you set your id as a page param defined in pages.xml. Then you could successfully access #{demoBean.message} within your page and get the expected result ("ID Is set!"). If you set the scope to event then you would get ("message not set").
Hopefully that helps,
Dustin
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077490#4077490
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077490
18Â years, 8Â months
[EJB 3.0] - Re: @PostLoad invoked before eagerly loaded property finishe
by icordoba
My Exception:
| Caused by: javax.persistence.PersistenceException: org.hibernate.LazyInitializationException: illegal access to loading collection
| at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
| at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:194)
| at org.jboss.ejb3.entity.TransactionScopedEntityManager.find(TransactionScopedEntityManager.java:171)
| at com.servengine.user.UserManagerBean.getUser(UserManagerBean.java:839)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
| at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
| at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| ... 60 more
| Caused by: org.hibernate.LazyInitializationException: illegal access to loading collection
| at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341)
| at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
| at org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:163)
| at com.servengine.user.User.ejbLoad(User.java:119)
| at sun.reflect.GeneratedMethodAccessor1187.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.hibernate.ejb.event.BeanCallback.invoke(BeanCallback.java:23)
| at org.hibernate.ejb.event.EntityCallbackHandler.callback(EntityCallbackHandler.java:78)
| at org.hibernate.ejb.event.EntityCallbackHandler.postLoad(EntityCallbackHandler.java:71)
| at org.hibernate.ejb.event.EJB3PostLoadEventListener.onPostLoad(EJB3PostLoadEventListener.java:35)
| at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:201)
| at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:854)
| at org.hibernate.loader.Loader.doQuery(Loader.java:729)
| at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
| at org.hibernate.loader.Loader.loadEntity(Loader.java:1860)
| at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
| at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
| at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3044)
| at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
| at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
| at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
| at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)
| at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
| at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
| at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
| at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
| at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:174)
| ... 75 more
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077475#4077475
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077475
18Â years, 8Â months