Showing posts with label oas. Show all posts
Showing posts with label oas. Show all posts

16 January 2012

The names of the primary key fields must correspond

I've faced some JPA Error (deployment-time error) which is:

The names of the primary key fields or properties in the primary key class [class FooBarPK] and those of the entity bean class [class FooBar] must correspond and their types must be the same. Also, ensure that you have specified id elements for the corresponding attributes in XML and/or an @Id on the corresponding fields or properties of the entity class.

The error appears when deploying some JPA project in Oracle App Server.

I've this entity:


@Entity
@IdClass(FooBarPK.class)
public class FooBar implements Serializable {
    
    private static final long serialVersionUID = 1L;
    

    @Id
    private Long id1;
    @Id
    private Long id2;
    
    //...
}

//And this is the PK class 

public class NewParaPK implements Serializable 
{
    private static final long serialVersionUID = 1L;

    private Long id1;
    private Long id2;
}

I wonder, why this happen...

I found this line:
private static final long serialVersionUID = 1L;

In the PK Class who cases the problem!

11 April 2011

Oracle Application Server overrides your own Jars

Hello,

I've noted that, Oracle Application server overrides Jar files that found on the app server.

You will need to customize your classpath when deployin from the `em` to make it works for you.

15 December 2010

BUG: Toplink doesn't correctly interpret named queries when you use setMaxResults() and setFirstResult()

Hi folks,

I found some bug in toplink that is shipped with Oracle App Server 10.1.3.4.0 (actually among many bugs!!)

According to JPA1.0 specs, Query.setMaxResults() and Query.setFirstResult() methods doesn't work with only queries that contains FETCH JOIN.

But unfortantely, when I tried these two methods with a normal INNER JOIN query, I got the query being changed and returned invalid results!!

So, beware of this!!!

Workaround:
One workaround is to make the join by equity joining columns.
ex:
select s from Suppliers s, Products p where s.productId = p.productId