[EJB 3.0] - Isolated Classloader with JPA (java.lang.ClassCastException:
by FelderR
Each EAR Deployment is isolated in a seperate Classloader. This is due to the fact, that we use different Hibernate versions on different EAR Deployments.
We specifiy the isolation in the jboss-app.xml file as following:
<jboss-app>
<loader-repository>classloader:loader=earfilename
<loader-repository-config>java2ParentDelegation=false
</loader-repository-config>
</loader-repository>
</jboss-app>
While migrating from native Hibernate access to JPA access we consider problems with this isolated classloaders, as the EntityManagerFactory is built from the Class org.jboss.ejb3.entity.PersistenceUnitDeployment. This class is in the Library jboss-ejb3.jar which is located in the lib directory of JBoss.
The problem is, that we fall back to the lib directory of JBoss and therefore the Hibernate Version that lies within this directory is used as persistence provider for JPA.
So we have two different versions of hibernate, one in the lib directory and one in the EAR file. This leads to the problem that we get a ClassCastException when setting the Dialect as the Dialect Object was used from the hibernate Version within the EAR file, the DialectFactory was used from the hibernate version within the lib directory.
Any ideas (especially to the JBoss Members) how to solve this issue?
Thx Rene
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054696#4054696
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054696
18Â years, 10Â months
[EJB 3.0] - Re: [JDBCExceptionReporter]'last_insert_id' is not a recogni
by pakhi
Hey.. thanks for your reply... I really appreciate the same so soon...
But now i am getting the error as follows:
15:56:14,638 ERROR [MultipleHiLoPerTableGenerator] could not read or init a hi value
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR. at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(
I made this change as you guided...
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
@Column (name="id")
public int getId() {
return id;
}
Please guide, is there some constaint in inserting into the table though this entity bean.
Thanks again... :)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054691#4054691
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054691
18Â years, 10Â months
[EJB 3.0] - Re: Database Connection
by alexrozario
Thank you sir.
thank you for your valuable response..
i have followed the things you have specified..
now i am in a right path i think, but still i cant finish my task.
i cant connect with database.
can you help me further.
i have created an entity bean as First.java(i have table named First in my remote database). i have created FirstEjb as remote interface and created FirstEjbBean as stateless session bean. my oracle jndi name is oracle..
but
while ruinning the server it shows the following error.
ObjectName: persistence.units:ear=New.ear,jar=NewEJB.jar,unitName=First
State: FAILED
Reason: javax.naming.NameNotFoundException: Oracle not bound
I Depend On:
jboss.jca:service=ManagedConnectionFactory,name=Oracle
Depends On Me:
jboss.j2ee:ear=New.ear,jar=NewEJB.jar,name=FirstEjb,service=EJB3
<persistence-unit name="First">
<jta-data-source>Oracle</jta-data-source>
</persistence-unit>
this is my persistence file.. i think i have to change here only..
i am in confused state..
can you please guide me to overcome this issue..
thank you sir..
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054687#4054687
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054687
18Â years, 10Â months