Wicket MyBatis Want to sort a row but can't update it

倾然丶 夕夏残阳落幕 提交于 2020-01-07 03:18:28

问题


Basically my java class that I want to sort should be working and we got the code for that. The thing is, when we try to simply just test if our link works(We got a link named "NAME" which should sort the list of people by the name, when clicked), by simply doing the code below. But it doesn't sort it. Our SQL is also correct so does anyone see the problem that we don't? We're fairly new to wicket.

public class SimpleView extends SimpleViewPage {

//denne er oprettet til brug til når der skal laves descending/ascending.
private final boolean descending = false;
ListView persons;

public SimpleView() {

    persons = new ListView("persons", getPersons()) {
        @Override
        protected void populateItem(ListItem item) {
            Person person = (Person) item.getModelObject();
            item.add(new Label("name", person.getName()));
            item.add(new Label("birthdate", person.getBirthdate()));
            item.add(new Label("phone", person.getPhone()));
        }
    };
    add(persons);
    add(new Label("size", "Number of people: " + getPersons().size()));
    add(new Link("namelink") {
        @Override
        public void onClick() {
            persons = new ListView("persons", getPersons()) {

                @Override
                protected void populateItem(ListItem item) {
                    Person person = (Person) item.getModelObject();
                    item.add(new Label("name", person.getName()));
                    item.add(new Label("birthdate", person.getBirthdate()));
                    item.add(new Label("phone", person.getBirthdate()));
                }

            };
        }
    });

SQL IS THIS:

<resultMap type="com.netdesign.domain.Person" id="personResult">
    <result property="name" column="name"/>
    <result property="birthdate" column="birthdate"/>   
    <result property="phone" column="phone"/>
</resultMap>

 <select id="sortBy" resultMap="personResult" >
    SELECT * FROM person ORDER BY name DESC
 </select>

Basically we just want our phone to update to birthdate, just so we can't see that our method works.

来源:https://stackoverflow.com/questions/25443397/wicket-mybatis-want-to-sort-a-row-but-cant-update-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!