I have two beans Feature and FeatureOption with CMR.
JBoss-HEAD created the tables correct, using the new feature to have the
same field as FK to parent and part of PK:
create table feature ( feature_id smallint not null, description
varchar(30), primary key (feature_id) constraint pk_feature );
create table feature_option ( feature_id smallint not null,
option_id integer not null, description varchar(30), primary key
(feature_id,option_id) constraint pk_feature_option );
alter table feature_option add constraint (foreign key (feature_id)
references feature constraint fk_featur_1isvfy8);
But everytime I try to add FeatureOptions to Feature, I get an Exception:
java.lang.IllegalStateException: CMR field Feature_options is mapped
to a foreign key which is a part for a primary key,
and primary key may only be set once in ejbCreate [EJB 2.0 Spec.10.3.5].
My code looks like this:
feature = featureHome.create( feature_id, description );
coll = feature.getOptions();
featureOption = featureOptionHome.create( feature_id, option_id,
description );
coll.add( featureOption ); // this line throws the exception.
So my Question is: How to add a FeatureOption to Feature ?
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user
- [JBoss-user] Re: Using CMR with PK-Field as FK Langelage, Frank
- [JBoss-user] Re: Using CMR with PK-Field as FK Alex Loubyansky
