[JBoss jBPM] - subclassing TaskInstance and setting up hibernate mapping fo
by rossputin
Hi guys,
as per the CustomTaskInstance example, I am subclassing TaskInstance, and adding a couple of simple properties, I have created a new class subclassing TaskInstance, and the hibernate mapping field to go with it...
What I am unsure about, is how the hibernate mapping file relates to my MySQL database, do I need to modify the original TaskInstance table in MySQL to reflect the changes (fields added) in my new extended class, or do I create a new table JBPM_NEWTASKINSTANCE that is a duplicate of JBPM_TASKINSTANCE table but with the new fields added.
My hibernate mapping file is listed below...
| <?xml version="1.0"?>
|
| <!DOCTYPE hibernate-mapping PUBLIC
| "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
| "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
| <hibernate-mapping default-access="field">
|
| <subclass name="com.mycomp.taskinstance.NewTaskInstance"
| extends="org.jbpm.taskmgmt.exe.TaskInstance"
| discriminator-value="C">
|
| <property name="someVariable1" column="SOMEVARIABLE1_" />
|
| </subclass>
|
| </hibernate-mapping>
|
When I run my unit test I see...
| INFO Configuration : Reading mappings from resource : com/mycomp/taskinstance/NewTaskInstance.hbm.xml
|
| INFO HbmBinder : Mapping subclass: com.mycomp.taskinstance.NewTaskInstance -> JBPM_TASKINSTANCE
|
I suppose the NewTaskInstance should map to either a modified JBPM_TASKINSTANCE or to JBPM_NEWTASKINSTANCE ?
And finally of course the test bombs out with...
| WARN JDBCExceptionReporter : SQL Error: 1054, SQLState: 42S22
| ERROR JDBCExceptionReporter : Unknown column 'newtaskins0_.SOMEVARIABLE1_' in 'field list'
|
because I either have not added the new field to JBPM_TASKINSTANCE, or have not added the new table required.. (not sure which).
If someone could give me a pointer as to the process of adding the new field in the table, or adding a new table I would appreciate it,
thanks
Ross
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088456#4088456
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088456
18 years, 7 months
[JBoss Seam] - Overriding TransactionFailed error message
by ector7280
I'm trying to replace "Transaction failed" with a message that will tell the user that they have violated a unique constraint.
The problem I'm having is that if I override the message in messages_en
it will be specific to unique constraints.
I tried overriding the FacesMessage in the EntityHome persist method but,
I'm gettting "The instance was not associated with this session" when I try to show that message on the page where the persist was attempted.
Here's the override:
| @End
| @Override
| public String persist()
| {
|
| try {
| super.persist();
| titleXiProjectFolder.create(getInstance().getProjectName());
| } catch (Exception e) {
|
| FacesMessages.instance().add("Record already exists.'Project Name' must be unique");
| return "failure";
| }
|
| return "success";
|
| }
|
Any ideas how to post this message on the calling page?
Thanks,
JR
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088451#4088451
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088451
18 years, 7 months