hibernate entity to json

后端 未结 4 884
伪装坚强ぢ
伪装坚强ぢ 2021-01-06 05:06

i use Hibernate 4 and Spring 3.

i have two entity.

Book entity

@Entity
@Table(name = \"book\")
public class Book implements Serializable {

          


        
4条回答
  •  情深已故
    2021-01-06 05:30

    Try using these two Jackson artifacts instead

    
    org.codehaus.jackson
    jackson-mapper-asl
    1.9.9
    
    
    
    org.codehaus.jackson
    jackson-core-asl
    1.9.9
    
    

    Also on your controller try by changing it to -

     @SuppressWarnings("unchecked")
    @RequestMapping( method = RequestMethod.GET,  produces = MediaType.APPLICATION_JSON_VALUE )
    public @ResponseBody List getBook() {
    

    Lastly, make sure your view is making a json request.

提交回复
热议问题