Hi
I have a table with a serial key defined as followes
CREATE TABLE log_profile_request
(
lpr_id serial NOT NULL,
lpr_number varchar(12) NOT NULL,
lpr_make varchar(20),
lpr_model varchar(20),
lpr_imei varchar(20),
lpr_software_version varchar(10),
lpr_profiles varchar(20),
lpr_received_dt timestamp,
lpr_response_dt timestamp,
CONSTRAINT "lpr-pk" PRIMARY KEY (lpr_id),
CONSTRAINT p_unique UNIQUE (lpr_id)
)
WITHOUT OIDS;
ALTER TABLE log_profile_request OWNER TO bruce;
The generated sequence no is as followes
ALTER TABLE log_profile_request ALTER COLUMN lpr_id SET DEFAULT
nextval('log_profile_request_lpr_id_seq'::regclass);
My declaration for the field is as followes
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
//@Column(name="lpr_id", nullable=false)
private Long id ;
Then I try and insert a row I get the following exception
Caused by: <openjpa-1.0.0-SNAPSHOT-r420667:564688 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: ERROR:
relation "log_profile_request_id_seq" does not exist {prepstmnt 33153822
SELECT CURRVAL('log_profile_request_id_SEQ')} [code=0, state=42P01]
The SQL is as followes
552 MSWITCH-DEV TRACE [<ClientThread-Pool#1-ID:25>] openjpa.jdbc.SQL - <t
25935701, conn 29263633> executing prepstmnt 3238031 INSERT INTO
log_profile_request (lpr_imei, lpr_make, lpr_model, lpr_number,
lpr_software_version, lpr_profiles, lpr_received_dt, lpr_response_dt) VALUES
(?, ?, ?, ?, ?, ?, ?, ?) [params=(String) 123456789012345678, (String)
CyberGroup, (String) Test Program, (String) 27828246844, (String) 123456,
(String) , (Timestamp) 2007-08-16 19:16:29.04, (Timestamp) 2007-08-16
19:16:29.3]
554 MSWITCH-DEV TRACE [<ClientThread-Pool#1-ID:25>] openjpa.jdbc.SQL - <t
25935701, conn 29263633> [2 ms] spent
555 MSWITCH-DEV TRACE [<ClientThread-Pool#1-ID:25>] openjpa.jdbc.SQL - <t
25935701, conn 29263633> executing prepstmnt 33153822 SELECT
CURRVAL('log_profile_request_id_SEQ')
I cannot seem to get the mapping right for this serial number field as was
wondering if someone had a few hints
PS: The @Column(name="lpr_id", nullable=false) is commented out because
otherwise OpenJPA throws an exception about already having a value in the
field.
PPS: This is a new database so if there is some alternative to this sql
mapping that works I can easily try that.