JPA problem
Hi,
i'm spanish and my english is not good, so i'll try write as well as i can...
i'm developing a web aplication using Struts, java 6 and the topLink essential implementation to JPA.
Basically there are two entities, Flats and his son entity, Property ("Inmueble" in Spanish). The problem appears when you insert many Properties (with his corresponding Flat), delete one of them, and inmediatly after you re-insert another flat. That's when say the exception: "java.lang.IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST:com.dalya.bbdd.entity.Inmueble [idInmueble=5]."
For insert, i do two save's, one for the Flat and the other for de Property in wich i've introduced the flat. we can introduced "n" Flat's and no problem never.
To clear, I just erased the Property because this relationship is marked with a cascade deleted, so, the floor connected also clears. When we clear, nor is there any problem apparently becuse on the BBDD persist the flat's i've introduced least that has been erased.
It is when we try to re-insert another floor when the exception jumps.
I tried to shut down the Tomcat server just after deleting the flat, and when you lift it and try to insert again, there're no problems.
When jumps the exception, if again attempt to save the floor, then it is recorded in the BBDD smoothly.
What did I do wrong??
If you want to see the source code, said to me, and i'll send it.
In ur application u r inserting child records(Properties) and parent record (Flats) at a time.
Actually that problem is raised when u will try to insert both child and parent records at a time.
For this purpose u have to maintain Cascade persist in the entity which u r inserting.
Similar Messages
-
JPA Problem using alias for columns in a query
Hello, I am having some problems with a query that I am trying to use in my JEE project. This query doesnt return an entity but a group of values. I created a class representing the result and a query with the jpa constructor expression but it is not working.
The problem is that in the query I added some alias to the results, and when I try to run the project it says that it cannot parse the query.
My Query:
Query query = em.createQuery("SELECT NEW vo.VOOperacionesAgrupadas (o.nemotecnico as nemotecnico, o.esCompra as esCompra, i.equivUltimo as equivUltimo, sum(o.saldo) as saldo, sum(o.utilidad) as utilidad, sum(o.tasaCompraVenta)/count(o.nemotecnico) as promedioTasaCompra, (i.equivUltimo-sum(o.tasaCompraVenta)/count(o.nemotecnico))*100 as puntosBasicos) FROM Operaciones o, Instrumentos i WHERE o.idUsuario = :idUsuario AND o.nemotecnico = i.nemotecnico AND o.estaCerrada = 'false' Group by o.nemotecnico, o.esCompra, i.equivUltimo"); When I use that the server returns :
Exception Description: Syntax error parsing the query [SELECT NEW vo.VOOperacionesAgrupadas (o.nemotecnico as nemotecnico, o.esCompra as esCompra, i.equivUltimo as equivUltimo, sum(o.saldo) as saldo, sum(o.utilidad) as utilidad, sum(o.tasaCompraVenta)/count(o.nemotecnico) as promedioTasaCompra, (i.equivUltimo-sum(o.tasaCompraVenta)/count(o.nemotecnico))*100 as puntosBasicos) FROM Operaciones o, Instrumentos i WHERE o.idUsuario = :idUsuario AND o.nemotecnico = i.nemotecnico AND o.estaCerrada = 'false' Group by o.nemotecnico, o.esCompra, i.equivUltimo], line 1, column 53: syntax error at [as].
Internal Exception: MismatchedTokenException(8!=82)
GRAVE: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [SELECT NEW vo.VOOperacionesAgrupadas (o.nemotecnico as nemotecnico, o.esCompra as esCompra, i.equivUltimo as equivUltimo, sum(o.saldo) as saldo, sum(o.utilidad) as utilidad, sum(o.tasaCompraVenta)/count(o.nemotecnico) as promedioTasaCompra, (i.equivUltimo-sum(o.tasaCompraVenta)/count(o.nemotecnico))*100 as puntosBasicos) FROM Operaciones o, Instrumentos i WHERE o.idUsuario = :idUsuario AND o.nemotecnico = i.nemotecnico AND o.estaCerrada = 'false' Group by o.nemotecnico, o.esCompra, i.equivUltimo], line 1, column 53: syntax error at [as].
Internal Exception: MismatchedTokenException(8!=82)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
Caused by: Exception [EclipseLink-8024] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Syntax error parsing the query [SELECT NEW vo.VOOperacionesAgrupadas (o.nemotecnico as nemotecnico, o.esCompra as esCompra, i.equivUltimo as equivUltimo, sum(o.saldo) as saldo, sum(o.utilidad) as utilidad, sum(o.tasaCompraVenta)/count(o.nemotecnico) as promedioTasaCompra, (i.equivUltimo-sum(o.tasaCompraVenta)/count(o.nemotecnico))*100 as puntosBasicos) FROM Operaciones o, Instrumentos i WHERE o.idUsuario = :idUsuario AND o.nemotecnico = i.nemotecnico AND o.estaCerrada = 'false' Group by o.nemotecnico, o.esCompra, i.equivUltimo], line 1, column 53: syntax error at [as].
Internal Exception: MismatchedTokenException(8!=82)
at org.eclipse.persistence.exceptions.JPQLException.syntaxErrorAt(JPQLException.java:362)
at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.handleRecognitionException(JPQLParser.java:304)
at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.addError(JPQLParser.java:245)
at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.reportError(JPQLParser.java:362)
at org.eclipse.persistence.internal.libraries.antlr.runtime.BaseRecognizer.recoverFromMismatchedElement(Unknown Source)
at org.eclipse.persistence.internal.libraries.antlr.runtime.BaseRecognizer.recoverFromMismatchedToken(Unknown Source)
at org.eclipse.persistence.internal.libraries.antlr.runtime.BaseRecognizer.mismatch(Unknown Source)
at org.eclipse.persistence.internal.libraries.antlr.runtime.BaseRecognizer.match(Unknown Source)
at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.constructorExpression(JPQLParser.java:2635)
at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectExpression(JPQLParser.java:2045)
at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectItem(JPQLParser.java:1351)
at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectClause(JPQLParser.java:1266)
at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectStatement(JPQLParser.java:352)
at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.document(JPQLParser.java:276)
at org.eclipse.persist
GRAVE: ence.internal.jpa.parsing.jpql.JPQLParser.parse(JPQLParser.java:133)
at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.buildParseTree(JPQLParser.java:94)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:198)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:173)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:125)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:109)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1326)
... 59 more
Caused by: MismatchedTokenException(8!=82)
... 74 more
What can I do?? I have been stuck in this problem for 2 weeks :s I have tried almost everything..
Thanks in advance for your help!SELECT tmp.contract_no, tmp.Actual, tmp.Actual - tmp.NbHours
FROM ( SELECT t.contract_no, sum(l.hrs) AS Actual, (c.labour_hours * c.labour_progress_per) / 100 AS NbHours
FROM TASK_DELEGATION t
INNER JOIN COST_CODE c
ON t.cost_code = c.cost_code AND t.contract_no = c.contract_no AND t.is_inactive=0
INNER JOIN Labour.dbo.LABOURALLOT l
ON l.contractNo = c.contract_no AND l.costcode = c.cost_code AND l.pm = 'N'
GROUP BY t.contract_no, c.labour_hours, c.labour_progress_per
) tmp -
JPA Problem: Table not found by JPA run-time
I am using NetWeaver 7.3 with an MS SQL Server 2008 and have created a EJB and EAR development component, which are correctly set up.
I want to access tables in the database. I have the problem that a colleague has created new tables in the database that I want to access via JPA. In NWDS, I can generate the entities without a problem through the JPA tools, using the Eclipse Data source of the MS SQL server. However, when I deploy the project, I get an error message upon injection of the entity manager, saying that the tables do not exist - although they are there for sure!
Caused by: java.lang.RuntimeException: The persistence unit is inconsistent with the database schema:
Error on entity >>com.sap.research.meregio.test.MerTest<<: The table >>MER_TEST<< does not exist.
Error on entity >>com.sap.research.meregio.test.MecSlot2<<: The table >>MER_SLOT2<< does not exist.
at com.sap.engine.services.orpersistence.entitymanager.EntityManagerFactoryImpl.validateSchemaAndFillInJdbcTypes(EntityManagerFactoryImpl.java:213)
at com.sap.engine.services.orpersistence.entitymanager.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:120)
at com.sap.engine.services.orpersistence.entitymanager.JtaEntityManagerFactoryImpl.<init>(JtaEntityManagerFactoryImpl.java:39)
at com.sap.engine.services.orpersistence.provider.PersistenceProviderImpl.createJtaEntityManagerFactory(PersistenceProviderImpl.java:251)
at com.sap.engine.services.orpersistence.provider.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:236)
at com.sap.engine.services.orpersistence.container.EMFInstanceCreator.getEntityManagerFactory(EMFInstanceCreator.java:134)
at com.sap.engine.services.orpersistence.container.ORPersistenceObjectFactory.getEMF(ORPersistenceObjectFactory.java:300)
at com.sap.engine.services.orpersistence.container.ORPersistenceObjectFactory.getObjectInstance(ORPersistenceObjectFactory.java:73)
at com.sap.engine.lib.injection.ReferenceObjectFactory.getObject(ReferenceObjectFactory.java:96)
at com.sap.engine.lib.injection.FieldInjector.inject(FieldInjector.java:113)
Can it be, that the JPA runtime in the server only allows me to access tables that I have created through a Dictionary component? Or is it a "refresh" problem, meaning that the application server does not realize that new tables have been created? If the latter is true, can I "flush" or "refresh" the DB schema in NW?Hi,
it depends on the data source your JPA application is running against.
If it is configured for Open SQL (e.g. you are using the system data source), you need to define your database tables using the Java Dictionary. If you are using the JPA Tooling (Dali) in the NWDS, you can associate your JPA project with a Java Dictionary Project or a Java Dictionary DC. Then, you can use forward mapping ("generate database tables from entities") to create database table definitions in the Java Dictionary that exactly match your tables required by your JPA application:
[http://help.sap.com/saphelp_nw73/helpdata/en/49/ede1daba7b088be10000000a421937/frameset.htm]
Unfortunately, it is not possible to import table definitions you have created using native tools into the Java Dictionary.
Adrian -
Jdeveloper 11 and/or toplink-jpa problem
Hello,
We have a big problem with toplink-jpa or jdev 11. I tried something very similar to the jdev/jpa tutorial (http://download-uk.oracle.com/otn_hosted_doc/jdeveloper/11/demos/JPA/JPA_Demo.html), only adapted to our db. I've been trying to solve this for hours, but whenever we run the sample facade client we created, we get this as only output:
Error opening zip file: toplink/jlib/essentials-agent.jar
Error occurred during initialization of VM
agent library failed to init: instrument
Process exited with exit code 1.
I would greatly appreciate some support, I'm desesperate, this project being an experiment to see how we can evolve from "classic" toplink to toplink/jpa.Please also note: I tried this with jre 1.5.0.6 and 1.6.0.1 . The first one says "Error opening zip file: toplink/jlib/essentials-agent.jar", 1.6 says "Error opening zip file or JAR manifest missing : toplink/jlib/essentials-agent.jar".
I also tried the 1.5.0.6 jvm which comes with jdev 10.x, which doesn't say (or does) anything.
I downloaded the las version of toplink/jpa, without any change.
All help greatly appreciated :-/ -
Please i have this problem wth toplink in netbeans 6.1
The reason am bringin this here is that it uses toplink implementation of JPA
I have two projects
1.project A
2. Project b
In project A i have a database with Users,Contacts tables with a datasource configured as projectAdDS pointing to projectADb
In projectB i have a different database with Users,Contacts tables with a datasource configured as projectBdDS pointing to projectBDb
Now the generated Entity Classes for each projects is Users , Contacts. They have the same name but different package name
in project a the Users Entity classes is com.projectA.Users while in projectB is com.projectB.Users.
Now the problem is where the webapplication of projectA tries to save a Users it save it in projectB database.
That is the problem even when the two persistent are pointing to two different datasources.
Project A Persistent. XML
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="RestfulPU" transaction-type="JTA">
<jta-data-source>phonebookdb</jta-data-source>
<class>com.chineduefoagui.entity.Contacts</class>
<class>com.chineduefoagui.entity.Users</class>
<class>com.chineduefoagui.entity.Userdetails</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties/>
</persistence-unit>
</persistence><?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="SoapProPU" transaction-type="JTA">
<jta-data-source>soapphonebook</jta-data-source>
<class>com.chineduefoagui.soap.entity.Users</class>
<class>com.chineduefoagui.soap.entity.Contacts</class>
<class>com.chineduefoagui.soap.entity.Userdetails</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties/>
</persistence-unit>
</persistence>Yes,
It looks like you are getting 2 connection attempts for phonebookdb (2 is normal) but receive soapphonebook as the connection - this is odd.
But, I am working fine. In my application which is working now with <exclude-unlisted-classes>true</exclude-unlisted-classes> on "all" persistence units
I am working with two (Cell) entities in different packages (both are in the EJB jar). So this is either an issue with entities in the WAR or it is a db platform issue surrounding JavaDB
See a screencap of both persistence units working on two different datasources with the same entity "alias" but different packages
[http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial#Two_Persistence_Units]
For reference I get the same 4 logs when I attempt a single JTA connection but in my case my datasource name is listed as null even though my app continues on ok.
In the case of using both persistence units I get 2 sets of 4 logs = 8 for the 4 connections to the 2 datasources
The two datasources in my case are Oracle11g (remoteJTA) and Oracle10g (localJTA) - both using the same 11g driver - so it is easier to tell them apart in the logs.
[EL Example|http://forums.oracle.com/forums/]: enterprise: Object: org.eclipse.persistence.example.jpa.server.entity.Cell@26145598( id: 1 state: null left: null right: null parent: HashSet@234560 references: HashSet@234560)
When i use the exampleDuplicate persistence unit i get a login for the first datasource
Oracle 10g = remoteJTA datasource
[EL Fine|http://forums.oracle.com/forums/]: 2008.12.15 15:43:56.356--Thread(Thread[)--Detected Vendor platform: org.eclipse.persistence.platform.database.oracle.Oracle10Platform
[EL Config|http://forums.oracle.com/forums/]: 2008.12.15 15:43:56.403--ServerSession(3303389)--Connection(18436986)--Thread(Thread[)--connecting(DatabaseLogin(
platform=>Oracle10Platform
user name=> ""
connector=>JNDIConnector datasource name=>null
[EL Config|http://forums.oracle.com/forums/]: 2008.12.15 15:43:56.419--ServerSession(3303389)--Connection(28810575)--Thread(Thread[)--Connected: jdbc:oracle:thin:@127.0.0.1:1521:orcl
User: SCOTT
Database: Oracle Version: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Driver: Oracle JDBC driver Version: 11.1.0.7.0-Production
[EL Config|http://forums.oracle.com/forums/]: 2008.12.15 15:43:56.419--ServerSession(3303389)--Connection(28892307)--Thread(Thread[)--connecting(DatabaseLogin(
platform=>Oracle10Platform
user name=> ""
connector=>JNDIConnector datasource name=>null
[EL Config|http://forums.oracle.com/forums/]: 2008.12.15 15:43:56.419--ServerSession(3303389)--Connection(26833471)--Thread(Thread[)--Connected: jdbc:oracle:thin:@127.0.0.1:1521:orcl
User: SCOTT
Database: Oracle Version: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Driver: Oracle JDBC driver Version: 11.1.0.7.0-Production
[EL Finest|http://forums.oracle.com/forums/]: 2008.12.15 15:43:56.419--ServerSession(3303389)--Thread(Thread[)--sequencing connected, state is Preallocation_NoTransaction_State
and the persist call
[EL Example|http://forums.oracle.com/forums/]: enterprise: ApplicationService persisting: [email protected]( id: null state: null left: null right: null parent: HashSet@18981093 references: HashSet@18981093) on EM: org.eclipse.persistence.internal.jpa.EntityManagerImpl@1a7ed8f> later when I use the other example persistence unit i get a login for the second datasource
Oracle 11g = localJTA datasource
[EL Fine|http://forums.oracle.com/forums/]: 2008.12.15 15:43:56.966--Thread(Thread[)--Detected Vendor platform: org.eclipse.persistence.platform.database.oracle.Oracle10Platform
[EL Config|http://forums.oracle.com/forums/]: 2008.12.15 15:43:56.966--ServerSession(25279766)--Connection(13859800)--Thread(Thread[)--connecting(DatabaseLogin(
platform=>Oracle10Platform
user name=> ""
connector=>JNDIConnector datasource name=>null
[EL Config|http://forums.oracle.com/forums/]: 2008.12.15 15:43:56.966--ServerSession(25279766)--Connection(6794127)--Thread(Thread[)--Connected: jdbc:oracle:thin:@10.156.53.19:1521:orcl
User: SCOTT
Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Driver: Oracle JDBC driver Version: 11.1.0.7.0-Production
[EL Config|http://forums.oracle.com/forums/]: 2008.12.15 15:43:56.966--ServerSession(25279766)--Connection(3176465)--Thread(Thread[)--connecting(DatabaseLogin(
platform=>Oracle10Platform
user name=> ""
connector=>JNDIConnector datasource name=>null
[EL Config|http://forums.oracle.com/forums/]: 2008.12.15 15:43:56.997--ServerSession(25279766)--Connection(1751745)--Thread(Thread[)--Connected: jdbc:oracle:thin:@10.156.53.19:1521:orcl
User: SCOTT
Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Driver: Oracle JDBC driver Version: 11.1.0.7.0-Production
[EL Finest|http://forums.oracle.com/forums/]: 2008.12.15 15:43:56.997--ServerSession(25279766)--Thread(Thread[)--sequencing connected, state is Preallocation_NoTransaction_State
and the persist call
[EL Example|http://forums.oracle.com/forums/]: enterprise: ApplicationService2 persisting: org.eclipse.persistence.example.jpa.server.entity.Cell@20979305( id: null state: null left: null right: null parent: HashSet@14247956 references: HashSet@14247956) on EM: org.eclipse.persistence.internal.jpa.EntityManagerImpl@14bf56d
Here is my whole persistence unit (note I am not using the RESOURCE_LOCAL one but I still need an exclude on it
.<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence [http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd]">
<persistence-unit name="exampleDuplicate" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>remoteJTA</jta-data-source>
<class>org.eclipse.persistence.example.jpa.server.entity.Cell</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="eclipselink.target-server" value="WebLogic_10"/>
<property name="eclipselink.logging.level" value="FINEST"/>
</properties>
</persistence-unit>
<persistence-unit name="example" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>localJTA</jta-data-source>
<class>org.eclipse.persistence.example.jpa.server.business.Cell</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="eclipselink.target-server" value="WebLogic_10"/>
<property name="eclipselink.logging.level" value="FINEST"/>
</properties>
</persistence-unit>
<persistence-unit name="exampleLocal" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>org.eclipse.persistence.example.jpa.server.business.Cell</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="eclipselink.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>
<property name="eclipselink.jdbc.platform" value="org.eclipse.persistence.platform.database.oracle.OraclePlatform"/>
<property name="eclipselink.jdbc.url" value="jdbc:oracle:thin:@127.0.0.1:1521:orcl"/>
<property name="eclipselink.jdbc.user" value="scott"/>
<property name="eclipselink.jdbc.password" value="tiger"/>
</properties>
</persistence-unit>
</persistence>
I also do not see anything from the persistence unit "SoapProPU" in the logs from your servlet. Have you initialized both persistence units there or are there logs from the other servlet?
For example I used the following servlet with 2 references to session beans that in turn reference the 2 pu's - or you could just use persistence unit injection on the servlet.
public class FrontController extends HttpServlet implements Servlet {
@EJB(beanName="ApplicationService")
public ApplicationServiceLocal applicationService;
@EJB(beanName="ApplicationService2")
public ApplicationServiceLocal2 applicationService2;
@Local @Stateless
public class ApplicationService2 implements ApplicationServiceLocal2 {
@PersistenceContext(unitName="exampleDuplicate", type=PersistenceContextType.TRANSACTION)
private EntityManager entityManager;
@Local@Stateless
public class ApplicationService implements ApplicationServiceLocal {
@PersistenceContext(unitName="example", type=PersistenceContextType.TRANSACTION)
private EntityManager entityManager;
This may be DB platform specific, I think a reproduction on the same JavaDBPlatform is required on our side.
You may be right about the alias name that is narrowed to Userdetails (with no qualifying package). I see the same message when creating the EntityManagerFactory for the particular PU from....
m_entityName = Helper.getShortClassName(getJavaClassName());
getLogger().logConfigMessage(MetadataLogger.ALIAS, getDescriptor(), m_entityName);
and get further because I forgot to add the following exclude so that predeploy does not pick up classes from the persistence.xml classpath.
<exclude-unlisted-classes>true</exclude-unlisted-classes>
I wil let you know when I have switched my reproduction to use JavaDB.
thank you
/michael [http://www.eclipselink.org/] -
Hi, I am new in JPA but I want to use it. I have 3 problems
1. To store data in database in encrypted form like password eg
INSERT INTO `usertable` ( `USERNAME` , `PASSWORD` )
VALUES (
'arwegasira', MD5( 'alli' )
);2. Select data using date as parameter
public List getAuditFiles(GregorianCalendar date) {
EntityManager em = getEntityManager();
try {
javax.persistence.Query q = em.createQuery("SELECT a FROM AuditFile a WHERE a.paymentdate like '" + DBHelper.getSqlDate(date.getTime()) + "%' order by a.paymentdate DESC ");
return q.getResultList();
} finally {
em.close();
}When I using the above code I get the following exception
Exception Description: The object [2008-04-11%], of class [class java.lang.String], from mapping [oracle.toplink.essentials.mappings.DirectToFieldMapping[paymentdate-->auditfile.PAYMENTDATE]] with descriptor [RelationalDescriptor(ali.rwega.model.AuditFile --> [DatabaseTable(auditfile)])], could not be converted to [class java.sql.Timestamp].This below is DBHelper.getSqlDate() method
public static java.sql.Date getSqlDate(Date date) {
return new java.sql.Date(date.getTime());
}3.How can I write relationships on entities from the following tables
CREATE TABLE IF NOT EXISTS USERINFOTABLE(
USERNAME varchar(32) NOT NULL,
FIRSTNAME varchar(32),
LASTNAME varchar(32),
TITLE varchar(70),
EMAIL varchar(100),
DEPT varchar(100),
PHOTO binary,
CONSTRAINT USERINFO_PK PRIMARY KEY(USERNAME)
CREATE TABLE IF NOT EXISTS USERTABLE(
USERNAME varchar(32) NOT NULL,
PASSWORD varchar(32) NOT NULL,
CONSTRAINT USER_PK PRIMARY KEY(USERNAME),
CONSTRAINT USER_FK FOREIGN KEY(USERNAME) REFERENCES USERINFOTABLE(USERNAME)
ON DELETE CASCADE ON UPDATE RESTRICT
CREATE TABLE IF NOT EXISTS GROUPINFOTABLE (
GROUPID varchar(32) NOT NULL,
DESCRIPTION varchar(255),
CONSTRAINT GROUPINFO_PK PRIMARY KEY (GROUPID)
CREATE TABLE IF NOT EXISTS GROUPTABLE(
USERNAME varchar(32) NOT NULL,
GROUPID varchar(32) NOT NULL,
CONSTRAINT GROUP_PK PRIMARY KEY(USERNAME, GROUPID),
CONSTRAINT USERINFO_FK FOREIGN KEY(USERNAME) REFERENCES USERINFOTABLE(USERNAME),
CONSTRAINT GROUP_FK FOREIGN KEY(GROUPID) REFERENCES GROUPINFOTABLE(GROUPID)
ON DELETE CASCADE ON UPDATE RESTRICT
);I need link where I can access JPA tutorilasThis does not belong in the JSF forum.
-
Hi,
First, sry for the english. I am newbie in java and i am stucked in a problem that i think is easy. I have an application that is running perfectly in red5. I am copying the files from this application (laboratory) to other folder in red5's directory WEBAPPS called laboratory2. I restart my Tomcat and red5 services but the following error is shown when i try to access my app from browser
root cause
java.lang.ExceptionInInitializerError
br.inf.mmc.msys.servico.persistencia.jpa.JPAUtil.<clinit>(JPAUtil.java:32)
br.inf.mmc.msys.web.filter.SegurancaFilter.doFilter(SegurancaFilter.java:48)
root cause
javax.persistence.PersistenceException: [PersistenceUnit: laboratorioPU] Unable to build EntityManagerFactory
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
root cause
org.hibernate.HibernateException: Could not instantiate dialect class
org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:84)
org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:42)
org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:426)
java.lang.ClassCastException: org.hibernate.dialect.MySQLDialect cannot be cast to org.hibernate.dialect.Dialect
org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:78)
org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:42)
org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:426)
org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:128)
org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
Persistence.xml
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="laboratory2PU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.connection.username" value="laboratorio"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.password" value="laboratorio"/>
<property name="hibernate.connection.url" value="jdbc:mysql://127.0.0.1/msysdb?autoReconnect=true"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.connection.autocommit" value="false"/>
<property name="current_session_context_class" value="thread"/>
</properties>
</persistence-unit>
</persistence>
I tried modify the persistence-unit name but the same error was shown. I was thinking that can be linked with jars.
tyHello,
I am not overly familar with the products involved so you might want to try forums more specific to the products you are using - though this forum does get general JPA questoins, it is more for TopLink which is a JPA provider.
From the Exception though it seems like a classloader issue where you might have two different versions of the Hibernate classes being loaded - did you also copy the hibernate jars? You might want to set up shared libraries rather than put tool jars in the application directly.
Or Try TopLink/EclipseLink as the JPA provider to verifty that it is not a Hibernate specific problem. -
JPA - Problem with editing the newly created Entity
Hi,
I am new to JPA technology.
I am having the Groups and Program table externally linked by GroupsProgams table of relationship many to many.
My requirement is:
while editing a group, i need to update group and associated GroupsPrograms based on the programs selected for this group.
my code for edit group is:
try {
userEntityManager.getTransaction().begin();
List<Program> programList = new ArrayList<Program>();
for (Integer programId : assignedProgramList) {
programList.add(new Program(programId));
group.setAssociatedGroupProgramsList(programList);
userEntityManager.merge(group);
userEntityManager.getTransaction().commit();
} catch (Exception e) {
throw new Exception("GROUP_ASSOCIATION_ERROR", e.getMessage());
}While editing the existing group this code is working fine.
But when i create a new group with some programs assigned to it then after some times editing the new group and adding some more programs to group is giving error:
please suggest me where its going wrong. because its working fine for the already existing groups but not for the new ones.
javax.persistence.RollbackException: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 9.1 (Build b36-rc)): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry '40-2' for key 1Error Code: 1062
Call:INSERT INTO groupsprograms (GP_PR_Id, GP_GR_Id) VALUES (?, ?)
bind => [2, 40]
Query:DataModifyQuery()
at oracle.toplink.essentials.internal.ejb.cmp3.transaction.base.EntityTransactionImpl.commit(EntityTransactionImpl.java:105)
at oracle.toplink.essentials.internal.ejb.cmp3.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:45)
at com.ecs.usermanagement.bl.UserManagerData.editGroup(UserManagerData.java:196)
at com.ecs.usermanagement.ui.UserManagerView.saveGroup(UserManagerView.java:1580)
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:597)
at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:776)
at org.jdesktop.application.ApplicationAction.actionPerformed(ApplicationAction.java:812)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)Thanks,
DAYAHi,
I am new to JPA technology.
I am having the Groups and Program table externally linked by GroupsProgams table of relationship many to many.
My requirement is:
while editing a group, i need to update group and associated GroupsPrograms based on the programs selected for this group.
my code for edit group is:
try {
userEntityManager.getTransaction().begin();
List<Program> programList = new ArrayList<Program>();
for (Integer programId : assignedProgramList) {
programList.add(new Program(programId));
group.setAssociatedGroupProgramsList(programList);
userEntityManager.merge(group);
userEntityManager.getTransaction().commit();
} catch (Exception e) {
throw new Exception("GROUP_ASSOCIATION_ERROR", e.getMessage());
}While editing the existing group this code is working fine.
But when i create a new group with some programs assigned to it then after some times editing the new group and adding some more programs to group is giving error:
please suggest me where its going wrong. because its working fine for the already existing groups but not for the new ones.
javax.persistence.RollbackException: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 9.1 (Build b36-rc)): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry '40-2' for key 1Error Code: 1062
Call:INSERT INTO groupsprograms (GP_PR_Id, GP_GR_Id) VALUES (?, ?)
bind => [2, 40]
Query:DataModifyQuery()
at oracle.toplink.essentials.internal.ejb.cmp3.transaction.base.EntityTransactionImpl.commit(EntityTransactionImpl.java:105)
at oracle.toplink.essentials.internal.ejb.cmp3.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:45)
at com.ecs.usermanagement.bl.UserManagerData.editGroup(UserManagerData.java:196)
at com.ecs.usermanagement.ui.UserManagerView.saveGroup(UserManagerView.java:1580)
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:597)
at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:776)
at org.jdesktop.application.ApplicationAction.actionPerformed(ApplicationAction.java:812)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)Thanks,
DAYA -
Weblogic 9.1 with toplink JPA - Problem creating entityManagerFactory
I am using weblogic 9.1 with toplink jpa provider.
I am getting the error while creating entityManagerFactory.
Exception stack trace
faces.FacesException: #{LogonMB.authenticateLogin}: javax.faces.el.EvaluationException: java.lang.ExceptionInInitializerError
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
at javax.faces.component.UICommand.broadcast(UICommand.java:332)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3153)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
Caused by: javax.faces.el.EvaluationException: java.lang.ExceptionInInitializerError
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:150)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
... 19 more
Caused by: java.lang.ExceptionInInitializerError
at com.arisglobal.cc.service.impl.PreferencesServiceImpl.getEntityManager(PreferencesServiceImpl.java:45)
at com.arisglobal.framework.service.AbstractBusinessService.(AbstractBusinessService.java:24)
at com.arisglobal.cc.service.impl.PreferencesServiceImpl.(PreferencesServiceImpl.java:36)
at com.arisglobal.cc.factory.BusinessServiceFactory.createPreferencesService(BusinessServiceFactory.java:113)
at com.arisglobal.cc.mb.LogonManagedBean.authenticateLogin(LogonManagedBean.java:51)
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 com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
... 20 more
Caused by: Exception [TOPLINK-34002] (Oracle TopLink Essentials - 2006.7 (Build 060720)): oracle.toplink.essentials.exceptions.XMLParseException
Exception Description: An exception occurred while processing persistence.xml from URL: file:/D:/ClinicalConnect/4. CODING/web/WEB-INF/classes/META-INF/persistence.xml. A SAXParser instance could not be created.
Internal Exception: org.xml.sax.SAXNotRecognizedException: http://java.sun.com/xml/jaxp/properties/schemaLanguage
at oracle.toplink.essentials.exceptions.XMLParseException.getXMLParseException(XMLParseException.java:101)
at oracle.toplink.essentials.exceptions.XMLParseException.exceptionCreatingSAXParser(XMLParseException.java:73)
at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:315)
at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processPersistenceArchveFromUnconvertableURL(PersistenceUnitProcessor.java:90)
at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:202)
at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcessor.java:77)
at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:222)
at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:240)
at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initializeFromMain(JavaSECMPInitializer.java:277)
at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.getJavaSECMPInitializer(JavaSECMPInitializer.java:80)
at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:118)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
at com.arisglobal.cc.helper.ResourceManager.(ResourceManager.java:8)hi JavaCrazyLover
u got why u getting the error i ma getting similar error its running fine in 8.1 but in web9.1 it is giving errors in some jsp pages may be due to versions or name spacing ie we write in top of the page DTD schema am not sure but i think , there is no jars to add on as such web 9.1 is upgraded one and it supports all files some where there will be conflicts between versions example JDK 1.5and 1.4 enum is a keyword in 9.1 but in normal in 8.1 if u get the solution for this error please mail me to [email protected]
rgds
Mohammed Mansoor -
JPA problem need help on JoinColumn, OneToMany, and ManyToOne annotations
I made a mistake in placing a foreign key.
but I don't really get what wrong with it
I have followed what shown on the book
Could somebody help me out? thanks!
package com.h2o;
import javax.persistence.*;
import java.util.*;
@Entity
@IdClass(h2oUserId.class)
@NamedQuery(name="findAllUsers", query="SELECT h FROM h2oUser h")
public class h2oUser {
@Id @GeneratedValue(strategy=GenerationType.SEQUENCE) @Column(name="H2O_ID")
private Long id;
@Id
@Column ( nullable = false)
private String email;
@Column ( nullable = false)
private String nickName;
@Column ( nullable = false)
private String password;
private String basePath;
private String avatorPath;
private boolean activated;
@Temporal(TemporalType.DATE)
private Date createDate;
@Transient
private static final String LARGE = "original";
@Transient
private static final String SMALL = "thumbernail";
@OneToMany(mappedBy="h2oUser")
private Collection<ImageBase> images;
//getters and setters
package com.h2o;
import javax.persistence.*;
@Entity
public class ImageBase {
@Id @GeneratedValue(strategy=GenerationType.SEQUENCE)
private Long id;
@Column(unique=true)
private String imgFile;
@Column(nullable=true)
private String imgOriginalFile;
@ManyToOne
@JoinColumn
private h2oUser user;
//getters and setters
Caused by: org.hibernate.MappingException: Could not determine type for: com.h2o.h2oUser, at table: ImageBase, for columns: [org.hibernate.mapping.Column(user)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:304)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:288)
at org.hibernate.mapping.Property.isValid(Property.java:216)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:467)
at org.hibernate.mapping.RootClass.validate(RootClass.java:268)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1287)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1729)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
... 9 moreYour solution may be there:
http://www.insideria.com/2010/02/using-coldfusion-9-orm-in-flex.html
Check out what Pedro did in the Flex class:
Note the tag:
[Entity]
[Id]
[ManyToOne
...etc...
package com.pcsilva.insideria.one.mxml.entity
[Bindable]
// pointing to an entity in ColdFusion
[RemoteClass(alias='com.pcsilva.insideria.one.cfml.entity.User')]
// declare entity
[Entity]
public class User
[Id] //statement identifier
public var id:Number = 0; // NaN is not going to ColdFusion
public var name:String;
public var lastname:String;
public var email:String;
// statement of relationship
[ManyToOne(targetEntity="com.pcsilva.insideria.one.cfml.entity.Group", fetchType="EAGER", cascadeType='ALL')]
[JoinColumn(name="group_id", referencedColumnName="id")]
// start property for use in getter groupname
public var group:Group = new Group();
[Transient] //add property read-only, which is not reflected in ColdFusion
public function get fullname():String
return name+' '+lastname;
[Transient] //add property read-only, simplifies access the property
public function get groupname():String
return group.name; -
[JPA] Saving big numbers to the database
Hi,
I have a JPA problem that I cannot solve. I try to save a large number to the database and JPA performs some strange rounding. For example, saving the number 9999999999999999.00 produces the following number in the database: 10000000000000000.00.
Actually, I'm not sure if it's JPA or the Oracle JDBC driver, but somebody rounds the number. That's bad!
Here's how to reproduce the issue:
1. Database:
create table big_num
(id number(18),
num number(19,2));
alter table big_num
add constraint big_num_pk primary key (id);
create sequence big_num_seq
start with 1
nocache;2. Entity:
@Entity
@Table(name="BIG_NUM")
@SequenceGenerator(name="bigNumSeq", sequenceName="BIG_NUM_SEQ", allocationSize=1)
public class BigNum {
@Id
@Column(name="ID", nullable=false)
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="bigNumSeq")
private Long id;
@Column(name="NUM")
private BigDecimal num;
public Long getId() {
return id;
public void setId(Long id) {
this.id = id;
public BigDecimal getNum() {
return num;
public void setNum(BigDecimal num) {
this.num = num;
}3. Code that causes the problem:
BigNum bn = new BigNum();
bn.setNum(new BigDecimal("9999999999999999.00"));
em.getTransaction().begin();
em.persist(bn);
em.getTransaction().commit();So, the INSERT statement that iss generated to the database is:
INSERT INTO BIG_NUM (ID, NUM) VALUES (?, ?)
bind => [1, 9999999999999999.00]However, the database contains the following:
SQL> select * from big_num;
ID NUM
1 10000000000000000,00Can somebody tell me if it's possible to save big numbers accurately into the database? If yes, then how?
Best regards,
BisserDisabling the bind variables produces the following:
INSERT INTO BIG_NUM (ID, NUM) VALUES (2, 9999999999999999.00)The database still joyfully contains a rounded number:
SQL> select * from big_num;
ID NUM
2 10000000000000000,00So, no, it's not an issue with the bind variables. I need to examine the JDBC driver but could you tell me how I can find out what Oracle JDBC driver is used by JPA? Or... is it some other JDBC driver (not Oracle, that is)?
Best regards,
Bisser
P.S. We use the following version of TopLink Essentials:
TopLink, version: Oracle TopLink Essentials - 2.1 (Build b60-fcs (11/17/2008))
Edited by: bisser on Jan 28, 2009 9:25 AM -
Hi,
I'have a JPQL-JPA problem.
When I run a JPQL Query like:
"SELECT x FROM User x WHERE x.association.idAssociation = 1 OR x.customer.association.idAssociation = 1"
Then, My "JPA Toplink Essentials" library generates a SQL Query like this:
"SELECT t0.id_user, t0.descripcion, t0.last_access, t0.password, t0.estado, t0.surname, t0.username, t0.movil, t0.name, t0.telefono,
t0.email, t0.id_customer, t0.id_society, t0.id_association, t0.id_language, t0.id_shop, t0.id_group
FROM customers t3, associations t2,associations t1, users t0
WHERE (((t1.id_association = ?) OR (t2.id_association= ?))
AND (((t1.id_association = t0.id_association) AND (t3.id_customer = t0.id_customer))
AND (t2.id_association = t3.id_association)))
There's a problem....near FROM clausule....table "associations" is repeated 2 times. Whhy?
These are my entities;
@Entity
@Table(name = "users")
public class User implements Serializable
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE)
@Column(name = "id_user")
private int id_user;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_association")
private Association association;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_customer")
private Customer customer;
@Entity
@Table(name = "associations")
public class Association implements Serializable
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE)
@Column(name="id_association")
private short idAssociation;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "association", cascade = CascadeType.ALL)
@JoinColumn(name = "id_association")
private List<User> users;
@Entity
@Table(name = "customers")
public class Customer implements Serializable
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE)
@Column(name="id_customer")
private int idCustomer;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "customer", cascade = CascadeType.ALL)
@JoinColumn(name = "id_customer")
private List<User> users;
Thanks in advance,I tried in one of my Employee examples using both:
SELECT e FROM Employee e WHERE e.address.city = 'Ottawa' OR e.address.city = 'Toronto'
and
SELECT e FROM Employee e JOIN e.address a WHERE a.city = 'Ottawa' OR a.city = 'Toronto'
In EclipseLink 1.0 both of these result in the same SQL. This may have been fixed in later versions of TopLink Essentials. Does the second approach of using the single JOIN fix your issue?
Doug -
1xM relation working in Hibernate doesn't work in Kodo and EclipseLink
Greetings,
I'm migrating some applications from JBoss/Hibernate to WebLogic 10gR3 and I found lots of JPA problems. In order to simplify the context, I used a very simple one to many bidirectional relationship between 2 entities. Using the following persistence.xml file:
<?xml version="1.0"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="ww204-jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>cgDataSource</jta-data-source>
<class>fr.simplex_software.jpa.Employee</class>
<class>fr.simplex_software.jpa.Department</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.transaction.factory_class"
value="org.hibernate.transaction.JTATransactionFactory" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />
<property name="jta.UserTransaction" value="java:comp/UserTransaction" />
</properties>
</persistence-unit>
</persistence>
the test works correctly on WebLogic 10gR3. Now, I'm modifying the persistence.xml to read:
<?xml version="1.0"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="ww204-jpa" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>cgDataSource</jta-data-source>
<class>fr.simplex_software.jpa.Employee</class>
<class>fr.simplex_software.jpa.Department</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="kodo.jdbc.SynchronizeMappings" value="refresh" />
</properties>
</persistence-unit>
</persistence>
The test raises the following exception:
Exception in thread "Main Thread" java.lang.ClassCastException: fr.simplex_software.jpa.Department
at fr.simplex_software.slsb.Facade_7ky0ac_FacadeRemoteImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
If I modify the persistence.xml to read:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="ww204-jpa" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider </provider>
<jta-data-source>cgDataSource</jta-data-source>
<class>fr.simplex_software.jpa.Employee</class>
<class>fr.simplex_software.jpa.Department</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
<property name="eclipselink.ddl-generation.output-mode"
value="database" />
</properties>
</persistence-unit>
</persistence>
the test raises the same exception. If I come back to the first persistence.xml file, the test works properly again. Is there something I'm doing wrong ?
Many thanks in advance for any help.
NicolasPerforming the following operations after having changed the persistence.xml file solve the problem:
1. Undeploy the application.
2. Run appc to re-generate stubs and copy them on the client CLASSPATH (see also How to run a Java EE client application ?
3. Stop the server.
4. Start the server.
5. Re-deploy the application.
All the above operations are purhaps not absolutely required but the whole procedure is sufficient to provide the expected result.
Kind regards,
Nicolas -
Problem with JPA Implementations and SQL BIGINT in primary keys
I have a general Question about the mapping of the SQL datatype BIGINT. I discovered, that there are some different behaviour depending on the JPA implementation. I tested with TopLink Essentials (working) and with Hibernate (not working).
Here is the case:
Table definition:
/*==============================================================*/
/* Table: CmdQueueIn */
/*==============================================================*/
create table MTRACKER.CmdQueueIn
CmdQueueInId bigint not null global autoincrement,
Type int,
Cmd varchar(2048),
CmdState int,
MLUser bigint not null,
ExecutionTime timestamp,
FinishTime timestamp,
ExecutionServer varchar(64),
ScheduleString varchar(64),
RetryCount int,
ResultMessage varchar(256),
RecordState int not null default 1,
CDate timestamp not null default current timestamp,
MDate timestamp not null default current timestamp,
constraint PK_CMDQUEUEIN primary key (CmdQueueInId)
The java class for this table has the following annotation for the primary key field:
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "CmdQueueInId", nullable = false)
private BigInteger cmdQueueInId;
When using hibernate 3.2.1 as JPA provider I get the following exception:
avax.persistence.PersistenceException: org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short or string
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
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.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:176)
at $Proxy16.persist(Unknown Source)
at com.trixpert.dao.CmdQueueInDAO.save(CmdQueueInDAO.java:46)
at com.trixpert.test.dao.CmdQueueInDAOTest.testCreateNewCmd(CmdQueueInDAOTest.java:50)
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 junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at
Caused by: org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short or string
at org.hibernate.id.IdentifierGeneratorFactory.get(IdentifierGeneratorFactory.java:59)
at org.hibernate.id.IdentifierGeneratorFactory.getGeneratedIdentity(IdentifierGeneratorFactory.java:35)
at org.hibernate.id.IdentityGenerator$BasicDelegate.getResult(IdentityGenerator.java:157)
at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:57)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2108)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2588)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
... 34 more
This means, that their ID generator does not support java.math.BigInteger as datatype.
But the code works if I take TopLink essentials as JPA Provider.
Looking at the spec shows the following:
In chapter 2.1.4 "If generated primary keys are used, only integral types will be portable." Integral datatypes are byte, short, int, long and char. This would mean, that the Hibernate implementation fits the spec but there seem to be a problem in general with BIGINT datatypes.
I use a SYBASE database. There it is possible to declare a UNSIGNED BIGINT. The range of numbers is therefore 0 - 2^64 - 1. Since in Java a long is always signed it would mean its range is from -2^63 -1 to 2^63 -1. So a mapping of BIGINT to java.lang.long could result in an overflow.
The interesting thing is, that I used NetBeans to reverse engineer an existing database schema. It generated for all Primary Keys of Type BIGINT automatically a java.math.BigInteger. But for other fields (not being keys) it mapped BIGINTs to java.lang.long.
It looks like there are some problems with either the spec itself or the implementation of it. While TopLink seems to handle the problem correctly, Hibernate doesn't. But Hibernate seems to fulfill the spec.
Is anybody familiar with the Spec reading this and can elaborate a little about this situation?
Many thanks for your input and feedback.
TomNot sure if I clearly understand your issue, would be good if you can explain it a bit more clearly.
"I select a value from LOV and this value don't refresh in the view"
If you mean ViewObject, check if autoSubmit property is set to true.
Amit -
Deployement problem in Oracle App Serv with hibernate + JPA and Spring
Dear All,
I am facing a problem in deployment of a web application in oracle application server 10g. but the same is working fine with Tomcat. The following Exception. Is being thrown.
Failed to deploy web application "OraTest". Failed to deploy web application OraTest". . Nested exception Resolution:
Base Exception:
java.rmi.RemoteException
deploy failed!: ; nested exception is:
oracle.oc4j.admin.internal.DeployerException: Unknown assembly root-tag attribute: version. deploy failed!: ; nested exception is:
oracle.oc4j.admin.internal.DeployerException: Unknown assembly root-tag attribute: version I am using the following technologies
1. Spring 2.0.7
2. Struts 2.0.9
3. Hibernate 3.3
4. JPA 1.0
5. Oracle App Server 10.1.2.0.2
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>My Application</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>
org.directwebremoting.servlet.DwrServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/conf/spring/datasource-context.xml,
/WEB-INF/conf/spring/aop-context.xml
</param-value>
</context-param>
</web-app>
/Datasource-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" lazy-init="true"/>
<!-- following code is for using oracle -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" lazy-init="true">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@//xxx.xxx.xxx.xxx/mydb</value>
</property>
<property name="username">
<value>admin</value>
</property>
<property name="password">
<value>admin</value>
</property>
</bean>
<!-- following code is for using mysql -->
<!--
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" lazy-init="true">
<property name="driverClassName">
<value>org.gjt.mm.mysql.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://192.168.10.157:3306/tpsadmin</value>
</property>
<property name="username">
<value>tpsadmin</value>
</property>
<property name="password">
<value>tpsadmin</value>+
</property>
</bean>
-->
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" lazy-init="true">
<property name="persistenceUnitName" value="mkclsetsPersistenceUnit"/>
<property name="dataSource" ref="dataSource"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" lazy-init="true">
<property name="database" value="ORACLE"/>
<property name="showSql" value="true"/>
</bean>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" lazy-init="true">
<property name="entityManagerFactory" ref="entityManagerFactory"></property>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
</beans>Aop-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<!-- Bean Definition of all the required Interceptors -->
<bean id="methodLoggingAdvice" class="com.mkcl.sets.common.interceptor.MehodLogInterceptor"/>
<!--
<bean id="appCacheManager" class="net.sf.ehcache.CacheManager">
<constructor-arg index="0" type="java.net.URL" value="classpath:country-ehcache.xml"/>
</bean>
-->
<!--bean id="methodCacheInterceptor" -->
<bean id="methodCachingAdvice"
class="com.mkcl.sets.common.interceptor.MethodCacheInterceptor">
<property name="cache">
<ref local="methodCache" />
</property>
</bean>
<bean id="cacheManager"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation">
<value>WEB-INF/conf/other/ehcache.xml</value>
</property>
</bean>
<bean id="methodCache"
class="org.springframework.cache.ehcache.EhCacheFactoryBean">
<property name="cacheManager">
<ref local="cacheManager" />
</property>
<property name="cacheName">
<value>mkclSetsCache</value>
</property>
</bean>
<!--
<bean id="methodCachingAdvice" class="interceptor.MethodCachingInterceptor"/>
-->
<aop:config>
<aop:pointcut id="getCountriesPointCut" expression="execution(* com.mkcl.sets.dao.master.impl.LocationDAOImpl.getCountries())"/>
<!-- <aop:pointcut id="methodLogPointCut" expression="execution(* com.mkcl.sets.service.master.impl.CategoryServiceImpl.getAllCategories(..))"/> -->
<aop:pointcut id="methodLogPointCutDao" expression="execution(* com.mkcl.sets.dao..*.*(..))"/>
<aop:pointcut id="methodLogPointCutService" expression="execution(* com.mkcl.sets.service..*.*(..))"/>
<aop:advisor id="methodCachingAdvisor" advice-ref="methodCachingAdvice" pointcut-ref="getCountriesPointCut"/>
<aop:advisor id="methodLoggingAdvisorDao" advice-ref="methodLoggingAdvice" pointcut-ref="methodLogPointCutDao"/>
<aop:advisor id="methodLoggingAdvisorService" advice-ref="methodLoggingAdvice" pointcut-ref="methodLogPointCutService"/>
</aop:config>
</beans>Persistence.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="mkclsetsPersistenceUnit" transaction-type="RESOURCE_LOCAL">
<!-- jta-data-source>mkclDS</jta-data-source-->
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<!-- properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.OC4JTransactionManager"/>
</properties-->
</persistence-unit>
</persistence>Do I need to add some other configuration in the existing files or do I need to add some other configuration files ? Please help to deploy my application.
Thanks a lot in advance.
With Best Regards,
Ishaan
nullDid you ever find a solution to this Ishaan?
I imagine you ended up having to upgrade 10gR2 to 10gR3 at least. Correct?
Maybe you are looking for
-
I accidentally deleted the latest backup for my iphone 6 on icloud like a week ago and now I can't backup my phone to icloud at all. When I go into settings, then into icloud, and then into manage my storage it does not give me the option to backup
-
Unable to Harvest a SOA composite from SOA suite server to OER11g
Hi All, I wanted to harvest a SOA composite from SOA suite server to OER11g.For that i had followed this portion *5.2.6.1 Harvesting from Oracle SOA Suite Server* from Oracle® Fusion Middleware Configuration Guide for Oracle Enterprise Repository11g
-
No sound with quicktime plug in on web pages
There's no sound when I play videos on web pages encoded with quicktime, however Flash videos, as on YouTube for example, do work. This seems to have happened recently, but I cannot pinpoint what caused it. One solution I found and have tried, is set
-
I have MS powerpoint on my macbook and I need to use a sony projector for teaching reasons. When I switch to "slide show" presentation, I get a blue screen. Whenever I leave the presenter mode, than everything becomes fine and I see the desktop on bo
-
ODSEE Connector Patch ID request
Hello Everyone We are using LDAP connector 11.1.1.6 version in OIM 11.2.2. The target is SunOne and we are using it in ODSEE format. Now, we are seeing a problem where even if the user is disabled in target and if we run 'LDAP Trusted Reconciliation'