(no subject) [solved] [message #715812] |
Mon, 15 August 2011 15:52 |
Felix Bodewald Messages: 8 Registered: July 2009 |
Junior Member |
|
|
Hello @all
i have got a problem with my GWT application. I'm using GWT 2.3, EclipseLink 2.3 and mysql with a xampp.
Everythink is working fine. I have got 3 classes in my db: Employee, Times and today i add BonusSalary. All classes are in the persistence.xml.
If i try to add, delete or modify somethink it is working well, but not with my new class BonusSalary.
if i execute this, 10 times from my gwt application it works 5 times.
EntityManager em = factory.createEntityManager();
Query q = em.createQuery("select count(e) from BonusSalary e");
here you can see what i get.
[EL Fine]: 2011-08-15 17:21:43.605--ServerSession(13373134)--Connection(18550117)--Thread(Thread[btpool0-6,5,main])--SELECT COUNT(DBID) FROM BONUSSALARY
[EL Fine]: 2011-08-15 17:21:45.29--ServerSession(13373134)--Connection(18550117)--Thread(Thread[btpool0-6,5,main])--SELECT COUNT(DBID) FROM BONUSSALARY
[EL Fine]: 2011-08-15 17:21:46.257--ServerSession(13373134)--Connection(18550117)--Thread(Thread[btpool0-6,5,main])--SELECT COUNT(DBID) FROM BONUSSALARY
an then suddenly, out of nowhere....
[WARN] Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.util.ArrayList de.octavia.reporting.client.services.ConnectionService.getDBSalaryContent()' threw an unexpected exception: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Error compiling the query [select count(e) from BonusSalary e]. Unknown entity type [BonusSalary].
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)
if i try i again and again, sometimes it is working. i can't believe it. The entity is load and it musst be working!!!!! But it won't work. The other entities are working fine.
1000 times on the gwt button, everytime the correct answer from eclipselink. But not this f*****g new class.
here is the config log:
[EL Config]: 2011-08-15 17:27:34.801--ServerSession(13907210)--Thread(Thread[btpool0-3,5,main])--The access type for the persistent class [class de.octavia.reporting.shared.Times] is set to [PROPERTY].
[EL Config]: 2011-08-15 17:27:34.839--ServerSession(13907210)--Thread(Thread[btpool0-3,5,main])--The access type for the persistent class [class de.octavia.reporting.shared.Employee] is set to [PROPERTY].
[EL Config]: 2011-08-15 17:27:34.841--ServerSession(13907210)--Thread(Thread[btpool0-3,5,main])--The access type for the persistent class [class de.octavia.reporting.shared.BonusSalary] is set to [PROPERTY].
if i try to execute something like that:
select e from BonusSalary e WHERE e.relevantMonth = :relevantMonth and e.employeeID = :emID
that is happening.
Starting Jetty on port 8888
[WARN] Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract de.reporting.shared.BonusSalary de.octavia.reporting.client.services.ConnectionService.getSalaryWithEmIDrelevantMonth(int,int)' threw an unexpected exception: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Error compiling the query [select e from BonusSalary e WHERE e.relevantMonth = :relevantMonth and e.employeeID = :emID]. Unknown entity type [BonusSalary].
if i try it from a JUnit test, the same method using the same class DBService its working, 1000 times....
this is the method:
EntityManagerFactory f = Persistence.createEntityManagerFactory("xxxxxxxxx");
EntityManager emt = f.createEntityManager();
Query q = emt.createQuery("select e from BonusSalary e WHERE e.relevantMonth = :relevantMonth and e.employeeID = :emID");
q.setParameter("relevantMonth", relevantMonth);
q.setParameter("emID", emID);
@SuppressWarnings("rawtypes")
List list = q.getResultList();
salary = (BonusSalary) list.get(0);
emt.clear();
emt.close();
i can't see the bug or my mistake.....
does anyone have an idea?
here is the code from the new class:
/* some importing stuff */
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
public class BonusSalary implements Serializable{
/**
*
*/
private static final long serialVersionUID = -6427354534163093973L;
private int dbID;
private int employeeID;
private Date lastChange = new Date();
public BonusSalary (){
}
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
public int getDBID() {
return dbID;
}
public void setDBID(int dbID) {
this.dbID = dbID;
}
public int getEmployeeID() {
return employeeID;
}
public void setEmployeeID(int employeeID) {
this.employeeID = employeeID;
}
@Temporal( value = TemporalType.TIMESTAMP )
@Column( nullable = false )
public Date getLastChange() {
return lastChange;
}
public void setLastChange(Date lastChange) {
this.lastChange = lastChange;
}
/* the class has 20 other variables, but i think they are not important,
they don't have any jpa signs */
so please help me!
[Updated on: Tue, 16 August 2011 06:22] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04267 seconds