Hi Guys,
Heres is the scenario, i have following tentative entities :
Person.java Entity
class Person {
@Composition
@OneToMany(mappedBy="Person")
private List<> badHabit;
@Composition
@OneToMany(mappedBy="Person")
private List<> goodHabit;
}
BadHabit.java Entity
class BadHabit{
@ManyToOne
@JoinColumn(name="fk_term_id")
protected HabitTerm habitTerm;
@ManyToOne
@JoinColumn(name="fk_person_id")
protected Person person;
}
Habit.java Entity
class Habit{
@Column(name="term_name")
protected String termName;
@Column(name="term_id")
protected String termId;
}
I am trying to load entity datasource Person
and option datasource Habit
using following :`
PersonEdit.xml
<dsContext>
<datasource id="personDs" class="com.example.entity.Person" view="person-view">
<datasource id="badHabitDs" property="badHabit"/>
<datasource id="goodHabitDs" property="goodHabit"/>
</datasource>
<collectionDatasource id="habitDs" class="com.example.entity.Habit"
datasourceClass="com.example.web.HabitDataSource"/>
</dsContext>
<layout>
<tokenList id="goodHabitTokenList" property="goodHabit" datasource="goodHabitDs">
<lookup optionsDatasource="habitDs" />
</tokenList>
</layout>
In the above situation the entity that is begin used inside optionDatasource is different then the one which is declared inside datasource attribute of tokenlist. With this apporach i am getting type cast error.
Is there any better and more effective solution for this use case.
Note : i have tried using KeyValue Entity but stuck with the same error.
Thanks,
S