Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

JPA no primary key

843830Mar 10 2010 — edited Aug 18 2010
hi ,
I have a some tables with no primary key, I'm mapping jpa entity beans, but it gives me error because I need to have a primary key. I was looking at Generated primary keys but i believe they require me to have a separate table in the database or and Id field in the table, but i cannot create any table in database or any new column because some dba issues. So i need to work around and simply insert data to those tables with no primary key. can someone tell me what is the best solution for this type of scenario.
package ejb.entity.cba;

import java.io.Serializable;
import java.sql.Date

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import java.io.Serializable;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;


@Entity
@Table(name = "OCD")
public class CBAOutlineCertifiedDetail implements Serializable {



//columns with no primary key 
private String accountNumber;
private String accountingLineItem;
private int    cbaId; 

//getters and setter 

}

..............
Edited by: s_dhillon on Mar 10, 2010 10:53 PM

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 15 2010
Added on Mar 10 2010
5 comments
6,924 views