SmartClient Version: v9.0p_2013-11-15/Pro Deployment (built 2013-11-15)
Google Chrome: Version 31.0.1650.63 m
Hello,
I've got questions regarding SelectItems and the binding of a JPA DataSource defined in a .ds.xml format.
First of all to keep this simple, here's an example:
Entities: Company, Person
Company
--------
id (Long)
name (string)
owner (Person)
Person
-------
id (Long)
firstName (String)
lastName (String)
employer (Company)
Now the first thing would be in the Form for the company, I'd want a SelectItem with all the persons. So I'd define this in the company.ds.xml:
In the CompanyForm.java I'd have something like this:
Now first of all, the Persons aren't sorted. They are ordered by Id. Did I use the SortField wrong?
Second issue would be that I'd want both firstname and lastname in the SelectItem displayed, as well as for the sorting. Would I have to use a DMI to concatenate these attributes?
Now to extend on this example, I'd also want to show the employer of the company's owner in the CompanyForm. How would I accomplish this result?
I've tried something like this in the company.ds.xml:
But I get a NullPointerException, what would be the right approach?
isc.logWarn("java.lang.NullPointerException\r\n\ta t
com.isomorphic.datasource.PoolableDataSourceFactor y.makeUnpooledObject(PoolableDataSourceFactory.jav a:130)\r\n\tat
com.isomorphic.datasource.PoolableDataSourceFactor y.makeObject(PoolableDataSourceFactory.java:138)\r \n\tat
org.apache.commons.pool.impl.GenericKeyedObjectPoo l.borrowObject(GenericKeyedObjectPool.java:1179)\r \n\tat
com.isomorphic.pool.PoolManager.borrowObject(PoolM anager.java:84)\r\n\tat
com.isomorphic.datasource.DataSourceManager.getDat aSource(DataSourceManager.java:95)\r\n\tat
com.isomorphic.datasource.DataSourceManager.getDat aSource(DataSourceManager.java:86)\r\n\tat
com.isomorphic.datasource.DataSourceManager.get(Da taSourceManager.java:118)\r\n\tat
...
Hope to get this sorted and thanks for any help in advance.
Google Chrome: Version 31.0.1650.63 m
Hello,
I've got questions regarding SelectItems and the binding of a JPA DataSource defined in a .ds.xml format.
First of all to keep this simple, here's an example:
Entities: Company, Person
Company
--------
id (Long)
name (string)
owner (Person)
Person
-------
id (Long)
firstName (String)
lastName (String)
employer (Company)
Now the first thing would be in the Form for the company, I'd want a SelectItem with all the persons. So I'd define this in the company.ds.xml:
Code:
<field name="ownerName" hidden="true" includeFrom="Person.name"/>
<field name="owner" displayField="ownerName" editorType="ComboBoxItem" foreignKey="Person.id"/>In the CompanyForm.java I'd have something like this:
Code:
SelectItem owner = new SelectItem("owner");
owner.setSortField("lastname")Now first of all, the Persons aren't sorted. They are ordered by Id. Did I use the SortField wrong?
Second issue would be that I'd want both firstname and lastname in the SelectItem displayed, as well as for the sorting. Would I have to use a DMI to concatenate these attributes?
Now to extend on this example, I'd also want to show the employer of the company's owner in the CompanyForm. How would I accomplish this result?
I've tried something like this in the company.ds.xml:
Code:
<field name="employer" includeFrom="Person.employer.name"/>But I get a NullPointerException, what would be the right approach?
isc.logWarn("java.lang.NullPointerException\r\n\ta t
com.isomorphic.datasource.PoolableDataSourceFactor y.makeUnpooledObject(PoolableDataSourceFactory.jav a:130)\r\n\tat
com.isomorphic.datasource.PoolableDataSourceFactor y.makeObject(PoolableDataSourceFactory.java:138)\r \n\tat
org.apache.commons.pool.impl.GenericKeyedObjectPoo l.borrowObject(GenericKeyedObjectPool.java:1179)\r \n\tat
com.isomorphic.pool.PoolManager.borrowObject(PoolM anager.java:84)\r\n\tat
com.isomorphic.datasource.DataSourceManager.getDat aSource(DataSourceManager.java:95)\r\n\tat
com.isomorphic.datasource.DataSourceManager.getDat aSource(DataSourceManager.java:86)\r\n\tat
com.isomorphic.datasource.DataSourceManager.get(Da taSourceManager.java:118)\r\n\tat
...
Hope to get this sorted and thanks for any help in advance.