Hi,
Is there any way to use .ds.xml file AND Datasource java defined (related both to same data source) together?
To be more clear, I'd like to define an .xml.ds like this:
and a client-side java class:
which work like a "proxy" for real DataSource. In this way a could define DMI via xml and optionally customize the DataSource elements (field-name, field-title, especially names that are re-used spreadingly in a lot of classes which contains data bind objects with ad-hoc field declaration) in located and easily maintenable classes.
The code in this example isn't working, I obtain :
and I'll report only for explantion pourposes.
I'm wonderin' if exist a method to successfully "mix" these two strategy (or if I could define "schemaBean" and "serverObject" attributes directly into DataSource java class).
Thanks,
Luca.
EDIT:
May I load .ds.xml DataSource and then inherit it and "override" fields into my java defined DataSource?
Is there any way to use .ds.xml file AND Datasource java defined (related both to same data source) together?
To be more clear, I'd like to define an .xml.ds like this:
Code:
<DataSource ID="kiosk" schemaBean="it.onetech.dtproviding.server.entity.Kiosk"> <serverObject lookupStyle="spring" bean="kioskDao" /> </DataSource>
Code:
public class KioskDS { private DataSource datasource = null; /** * Default constructor */ public KioskDS () { datasource = DataSource.get("kiosk"); DataSourceField id = new DataSourceField("id", FieldType.SEQUENCE); id.setPrimaryKey(true); id.setHidden(true); id.setRequired(true); DataSourceField alias = new DataSourceField(KioskDSFields.NAME.getAlias(), FieldType.TEXT, I18n.CST.kioskDSAliasTitle()); DataSourceField iNetAddress = new DataSourceField(KioskDSFields.INETADDRESS.getAlias(), FieldType.TEXT, I18n.CST.kioskDSINetAddressTitle()); DataSourceField regDate = new DataSourceField(KioskDSFields.REGDATE.getAlias(), FieldType.DATETIME, I18n.CST.kioskDSRegDateTitle()); DataSourceField addInfos = new DataSourceField(KioskDSFields.ADDINFO.getAlias(), FieldType.TEXT, I18n.CST.kioskDSAddInfoTitle(), 1000); DataSourceField group = new DataSourceField(KioskDSFields.GROUP.getAlias(), FieldType.INTEGER, I18n.CST.kioskDSGroupTitle()); DataSourceField lastHB = new DataSourceField(KioskDSFields.LASTHB.getAlias(), FieldType.DATETIME, I18n.CST.kioskDSLastHBTitle()); datasource.setFields(id, alias, iNetAddress, regDate, addInfos, group, lastHB); } public DataSource getDataSource() { return datasource; } }
The code in this example isn't working, I obtain :
Code:
java.lang.IllegalStateException: Fields cannot be added to a DataSource after the underlying component has been created
I'm wonderin' if exist a method to successfully "mix" these two strategy (or if I could define "schemaBean" and "serverObject" attributes directly into DataSource java class).
Thanks,
Luca.
EDIT:
May I load .ds.xml DataSource and then inherit it and "override" fields into my java defined DataSource?
Comment