mercredi 29 juin 2016

QueryforList result show table name

I use springjdbctemplate to query data from hive database.

This is my code:

@RestController
public class QueryController {
    @Autowired
    protected JdbcTemplate hiveTemplate;

    @RequestMapping("/query")
    public List query() {
        List data = hiveTemplate.queryForList("select * from ecg.hivetbluserdata limit 100");
        return data;
    }
}

But it returns this:

[{"hivetbluserdata.id_data":1,"hivetbluserdata.id_user":1,"hivetbluserdata.time":"Thursday, April 09, 2015 18:09:26","hivetbluserdata.ecgvalue":3.3871,"hivetbluserdata.inputtime":"2015-04-09 18:11:25.0"},
{"hivetbluserdata.id_data":2,"hivetbluserdata.id_user":1,"hivetbluserdata.time":"Thursday, April 09, 2015 18:09:26","hivetbluserdata.ecgvalue":1.56892,"hivetbluserdata.inputtime":"2015-04-09 18:11:25.0"},
{"hivetbluserdata.id_data":3,"hivetbluserdata.id_user":1,"hivetbluserdata.time":"Thursday, April 09, 2015 18:09:26","hivetbluserdata.ecgvalue":1.60802,"hivetbluserdata.inputtime":"2015-04-09 18:11:26.0"},
{"hivetbluserdata.id_data":4,"hivetbluserdata.id_user":1,"hivetbluserdata.time":"Thursday, April 09, 2015 18:09:26","hivetbluserdata.ecgvalue":2.09677,"hivetbluserdata.inputtime":"2015-04-09 18:11:26.0"},
{"hivetbluserdata.id_data":5,"hivetbluserdata.id_user":1,"hivetbluserdata.time":"Thursday, April 09, 2015 18:09:26","hivetbluserdata.ecgvalue":1.99902,"hivetbluserdata.inputtime":"2015-04-09 18:11:26.0"},
{"hivetbluserdata.id_data":6,"hivetbluserdata.id_user":1,"hivetbluserdata.time":"Thursday, April 09, 2015 18:09:26","hivetbluserdata.ecgvalue":1.97947,"hivetbluserdata.inputtime":"2015-04-09 18:11:26.0"},
{"hivetbluserdata.id_data":7,"hivetbluserdata.id_user":1,"hivetbluserdata.time":"Thursday, April 09, 2015 18:09:26","hivetbluserdata.ecgvalue":1.94037,"hivetbluserdata.inputtime":"2015-04-09 18:11:26.0"},
{"hivetbluserdata.id_data":8,"hivetbluserdata.id_user":1,"hivetbluserdata.time":"Thursday, April 09, 2015 18:09:27","hivetbluserdata.ecgvalue":1.56892,"hivetbluserdata.inputtime":"2015-04-09 18:11:26.0"},

I don't want to show the table name (hivetbluserdata is the table name). How can I solve this problem?

Aucun commentaire:

Enregistrer un commentaire