[jboss-user] [JBoss Seam] - inserting into associations..

minamti do-not-reply at jboss.com
Wed Oct 10 13:58:31 EDT 2007


How should I insert into associations. 

Let's say I have the following tables..

create table user (
user_id bigint unsigned NOT NULL, 
user_name varchar(255) NOT NULL,
PRIMARY KEY(user_id)
);

create table actions (
action_id tinyint unsigned not null, 
action_name varchar(255) NOT NULL, 
PRIMARY KEY(action_id));

create table user_actions (
user_id bigint unsigned not null, 
action_id tinyint unsigned NOT NULL, 
session_id varchar(255),
action_time TIMESTAMP NOT NULL,
PRIMARY KEY (user_id, action_id, session_id, action_timestamp)
FOREIGN KEY(user_id) REFERENCES user(user_id) ON UPDATE CASCADE ON DELETE RESTRICT, 
FOREIGN KEY(action_id) REFERENCES actions(action_id) ON UPDATE CASCADE ON DELETE RESTRICT);

Lets say the user record exists and the action record exists. What is the  way to insert a record into user_actions. 

If I try to persist a UseractionsAssocHome object obtained from Component.getInstance, I get a EntityNotFound exception.  

Caused by: org.jboss.seam.framework.EntityNotFoundException: entity not found: c
om.foo.entity.UserActionAssoc#com.foo.entity.UserActionAssocId at 6bca1c13
        at org.jboss.seam.framework.Home.handleNotFound(Home.java:109)
        at org.jboss.seam.framework.EntityHome.find(EntityHome.java:75)
        at org.jboss.seam.framework.Home.initInstance(Home.java:91)
        at org.jboss.seam.framework.Home.getInstance(Home.java:71)
        at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:50)
        at com.foo.entity.UserActionAssocHome.persist(UserActionAssocHome.jav
a:29)

Thanks, 

M

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093647#4093647

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093647



More information about the jboss-user mailing list