Hi. I don't know if this is more a Seam issue or a Hibernate issue
I have a many-to-many relationship between Restaurant and Service.
The join table has 3 fields:
RESTAURANT_SERVICE_ID RESTAURANT_ID SERVICE_ID
I cannot change the structure of the table, yet the mappings between the Restaurant and Service classes works fine
The problem shows up when I try to edit the services a resturant has, for example:
<h:selectManyCheckbox id="rServices" value="#{restaurantHome.instance.services}"> <s:selectItems value="#{serviceList.resultList}" var="service" label="#{service.name}" /> <s:convertEntity /> </h:selectManyCheckbox>
This shows the current services fine, but when I try to edit it, it won't insert properly the join table: the generated query doesn't take into account the RESTAURANT_SERVICE_ID (the PK), hence failing the transaction, like this:
22:30:57,837 INFO [STDOUT] Hibernate: insert into RESTAURANT_SERVICE (RESTAURANT_ID, SERVICE_ID) values (?, ?) Caused by: java.sql.BatchUpdateException: ORA-01400: cannot insert NULL into ("RESTAURANT_SERVICE"."RESTAURANT_SERVICE_ID") at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343) at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10657) at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:774) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268) ... 98 more
Is there any workaround for this? Or should I have to add those in custom code?
Thanks
Andrés