Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Spring
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Liutauras Vilda
Paul Clapham
Sheriffs:
paul wheaton
Tim Cooke
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Piet Souris
Bartenders:
Mike London
Forum:
Spring
@JsonIdentityInfo causing Unsupported Media Type
Nathan Milota
Ranch Hand
Posts: 447
3
posted 1 year ago
Number of slices to send:
Optional 'thank-you' note:
Send
Here is my class.
package com.km.theatretix.entity; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.ObjectIdGenerators; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor @Entity public class Seat { @Id @GeneratedValue private long id; @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property="id", scope=Long.class) @ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name="venue_id", referencedColumnName="id", nullable=false) private Venue venue; private String section; private String row; private long seatNumber; public long getId() { return id; } public void setId(long id) { this.id = id; } public Venue getVenue() { return venue; } public void setVenue(Venue venue) { this.venue = venue; } public String getSection() { return section; } public void setSection(String section) { this.section = section; } public String getRow() { return row; } public void setRow(String row) { this.row = row; } public long getSeatNumber() { return seatNumber; } public void setSeatNumber(long seatNumber) { this.seatNumber = seatNumber; }
The problem is, without the annotation, I can't get it to work properly on a GET request. Is there any workaround?
Himai Minh
Bartender
Posts: 2266
13
posted 1 year ago
Number of slices to send:
Optional 'thank-you' note:
Send
I guess the objects cannot be serialized into JSON and that causes unsupported media type.
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Inheritance Issues
Sping Data Create a Post method with List
For loop Inside For Loop. How to simplify?
result display error
More Major Inheritance Stuff.
More...