Master-Detail tables and foreign keys

Hi!
I’m trying to create master-detail tables.
When the user clicks on some row of the master table, a Form shows up that enables him to fill lots of detail Tables. This is working ok.
I’m using SQLContainers for each table (master and details).
But I have a “+” button that permits the user to add a new item to the master table, that when pressed shows a Form with the Detail tables.
But, as this new item is a temporary one, how can I populate the (detail) tables on the database if I have no foreign key value to provide?

Thanks a lot for your precious help.
David Pinheiro

I’ve tried to add a listener to the SQLContainer, but the manual says that RowIdChangeEvent is only implemented in TableQuery, and i’m using FreeformQuery.

        	sqlContainer.addListener(new QueryDelegate.RowIdChangeListener() {
                public void rowIdChange(RowIdChangeEvent event) {
                    System.out.println("Old detail ID: " + event.getOldRowId());
                    System.out.println("New detail ID: " + event.getNewRowId());
                }
        	});

Any help is welcomed.

David