Hello Isomorphic,
from searching the forums (e.g. http://forums.smartclient.com/showth...e+Primary+Keys) and reading the docs (e.g. http://www.smartclient.com/smartgwte...imaryKey%28%29) I get that you strongly advise not to use composite primary keys.
In my example I have a composite PK in the DB, but don't need it in SmartGWT (id=sequence, tenant_id=integer; "id" alone would be identifying, but to have all foreign keys to link only "inside the same tenant", I add the tenant_id to the PK).
The PK in the DB is (tenant_id, id) not the other way around. In SmartGWT it is only id.
What happens after an add to a DataSource is now that SmartGWT gets sequenceName.CurrVal and does a fetch with it. For update it already has the PK and does the fetch.
I'd like to interfere here and add the tenant_id to the fetch. Is this somehow possible?
I subclassed the IDACall Servlet
, but these methods are not used for the auto-fetch after the add/update.
If I could @override here as well I could add the tenant_id and use only one sequence-PK in SmartGWT as you suggest.
Is that somehow possible?
The other possibility I see is using useForCacheSync (http://www.smartclient.com/smartgwte...seForCacheSync) with an additional <criteria>-clause in every DS, but this adds a lot of boilerplate code.
Thank you & Best regards,
Blama
from searching the forums (e.g. http://forums.smartclient.com/showth...e+Primary+Keys) and reading the docs (e.g. http://www.smartclient.com/smartgwte...imaryKey%28%29) I get that you strongly advise not to use composite primary keys.
In my example I have a composite PK in the DB, but don't need it in SmartGWT (id=sequence, tenant_id=integer; "id" alone would be identifying, but to have all foreign keys to link only "inside the same tenant", I add the tenant_id to the PK).
The PK in the DB is (tenant_id, id) not the other way around. In SmartGWT it is only id.
What happens after an add to a DataSource is now that SmartGWT gets sequenceName.CurrVal and does a fetch with it. For update it already has the PK and does the fetch.
I'd like to interfere here and add the tenant_id to the fetch. Is this somehow possible?
I subclassed the IDACall Servlet
Code:
@Override public DSResponse handleDSRequest(DSRequest arg0, RPCManager arg1, RequestContext arg2) throws Exception {...} and @Override public void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {...}
If I could @override here as well I could add the tenant_id and use only one sequence-PK in SmartGWT as you suggest.
Is that somehow possible?
The other possibility I see is using useForCacheSync (http://www.smartclient.com/smartgwte...seForCacheSync) with an additional <criteria>-clause in every DS, but this adds a lot of boilerplate code.
Thank you & Best regards,
Blama
Comment