i want to store the JSON using spring boot with JPA
up vote
0
down vote
favorite
"id" :"3",
"userId": "abc",
"favName": "shashank",
"kpiName": "FavKPI",
"rptId": "529",
"language": "EN",
"selectedControlIdList": [
"favouriteId": 3,
"controlId": "3",
"controlName": " ",
"label": "Plant",
"keyValue": "KPI_01_PL_01_1",
"structureType": "LISTBOX"
,
"favouriteId": 3,
"controlId": "2",
"controlName": " ",
"label": "Plant12",
"keyValue": "KPI_01",
"structureType": "LISTBOX"
]
My controller class is
@RequestMapping(value = "/addFavData", method = RequestMethod.POST, consumes =MediaType.APPLICATION_JSON_VALUE, produces =MediaType.APPLICATION_JSON_VALUE)
public void addFavData(@RequestBody FavouriteDTO requestInputMapper)
favouriteService.addFavouriteData(requestInputMapper);
service class
public void addFavouriteData(FavouriteDTO requestInputMapper)
favouriteRepository.save(requestInputMapper);
And these are entity class !!
@Entity
@Table(name = "favorite", schema = "quality")
public class FavouriteDTO implements Serializable
private static final long serialVersionUID = -7089417397407966229L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "userId")
private String userId;
@Column(name = "favName")
private String favName;
@Column(name = "kpiName")
private String kpiName;
@Column(name = "rptId")
private String rptId;
@Column(name = "language")
private String language;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "favouriteId")
private List<DefaultControlsDTO> selectedControlIdList;
And
@Entity
@Table(name = "favoriteControls", schema = "quality")
public class DefaultControlsDTO implements Serializable
private static final long serialVersionUID = 8720721227933753311L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "favouriteId")
private Integer favouriteId;
@Column(name = "controlId")
private String controlId;
@Column(name = "controlName")
private String controlName;
@Column(name = "label")
private String label;
@Column(name = "keyValue")
private String keyValue;
@Column(name = "structureType")
private String structureType;
here the id is auto genrated. and the favouriteId is same as id.
so how can i store the data as id is auto genrated and i need to put the same favourite id as in id. so how can i store the data in the data base
so i have given my entity class. i have two entity Favorite and DefaultFavuorite Entity.so how can i store the data
spring spring-boot spring-data-jpa
|
show 8 more comments
up vote
0
down vote
favorite
"id" :"3",
"userId": "abc",
"favName": "shashank",
"kpiName": "FavKPI",
"rptId": "529",
"language": "EN",
"selectedControlIdList": [
"favouriteId": 3,
"controlId": "3",
"controlName": " ",
"label": "Plant",
"keyValue": "KPI_01_PL_01_1",
"structureType": "LISTBOX"
,
"favouriteId": 3,
"controlId": "2",
"controlName": " ",
"label": "Plant12",
"keyValue": "KPI_01",
"structureType": "LISTBOX"
]
My controller class is
@RequestMapping(value = "/addFavData", method = RequestMethod.POST, consumes =MediaType.APPLICATION_JSON_VALUE, produces =MediaType.APPLICATION_JSON_VALUE)
public void addFavData(@RequestBody FavouriteDTO requestInputMapper)
favouriteService.addFavouriteData(requestInputMapper);
service class
public void addFavouriteData(FavouriteDTO requestInputMapper)
favouriteRepository.save(requestInputMapper);
And these are entity class !!
@Entity
@Table(name = "favorite", schema = "quality")
public class FavouriteDTO implements Serializable
private static final long serialVersionUID = -7089417397407966229L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "userId")
private String userId;
@Column(name = "favName")
private String favName;
@Column(name = "kpiName")
private String kpiName;
@Column(name = "rptId")
private String rptId;
@Column(name = "language")
private String language;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "favouriteId")
private List<DefaultControlsDTO> selectedControlIdList;
And
@Entity
@Table(name = "favoriteControls", schema = "quality")
public class DefaultControlsDTO implements Serializable
private static final long serialVersionUID = 8720721227933753311L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "favouriteId")
private Integer favouriteId;
@Column(name = "controlId")
private String controlId;
@Column(name = "controlName")
private String controlName;
@Column(name = "label")
private String label;
@Column(name = "keyValue")
private String keyValue;
@Column(name = "structureType")
private String structureType;
here the id is auto genrated. and the favouriteId is same as id.
so how can i store the data as id is auto genrated and i need to put the same favourite id as in id. so how can i store the data in the data base
so i have given my entity class. i have two entity Favorite and DefaultFavuorite Entity.so how can i store the data
spring spring-boot spring-data-jpa
2
What have you done yet?
– Alex Foglia
Nov 12 at 5:37
i have created the data model and then through save method i am calling
– Shashank Ranjan
Nov 12 at 5:46
controller--> service--->Repo <myEntiyclass, Integer>
– Shashank Ranjan
Nov 12 at 5:47
please share your code
– rockyBalboa
Nov 12 at 5:48
controller class @RequestMapping(value = "/addFavData", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public void addFavData(@RequestBody FavouriteDTO requestInputMapper) favouriteService.addFavouriteData(requestInputMapper);
– Shashank Ranjan
Nov 12 at 5:55
|
show 8 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
"id" :"3",
"userId": "abc",
"favName": "shashank",
"kpiName": "FavKPI",
"rptId": "529",
"language": "EN",
"selectedControlIdList": [
"favouriteId": 3,
"controlId": "3",
"controlName": " ",
"label": "Plant",
"keyValue": "KPI_01_PL_01_1",
"structureType": "LISTBOX"
,
"favouriteId": 3,
"controlId": "2",
"controlName": " ",
"label": "Plant12",
"keyValue": "KPI_01",
"structureType": "LISTBOX"
]
My controller class is
@RequestMapping(value = "/addFavData", method = RequestMethod.POST, consumes =MediaType.APPLICATION_JSON_VALUE, produces =MediaType.APPLICATION_JSON_VALUE)
public void addFavData(@RequestBody FavouriteDTO requestInputMapper)
favouriteService.addFavouriteData(requestInputMapper);
service class
public void addFavouriteData(FavouriteDTO requestInputMapper)
favouriteRepository.save(requestInputMapper);
And these are entity class !!
@Entity
@Table(name = "favorite", schema = "quality")
public class FavouriteDTO implements Serializable
private static final long serialVersionUID = -7089417397407966229L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "userId")
private String userId;
@Column(name = "favName")
private String favName;
@Column(name = "kpiName")
private String kpiName;
@Column(name = "rptId")
private String rptId;
@Column(name = "language")
private String language;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "favouriteId")
private List<DefaultControlsDTO> selectedControlIdList;
And
@Entity
@Table(name = "favoriteControls", schema = "quality")
public class DefaultControlsDTO implements Serializable
private static final long serialVersionUID = 8720721227933753311L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "favouriteId")
private Integer favouriteId;
@Column(name = "controlId")
private String controlId;
@Column(name = "controlName")
private String controlName;
@Column(name = "label")
private String label;
@Column(name = "keyValue")
private String keyValue;
@Column(name = "structureType")
private String structureType;
here the id is auto genrated. and the favouriteId is same as id.
so how can i store the data as id is auto genrated and i need to put the same favourite id as in id. so how can i store the data in the data base
so i have given my entity class. i have two entity Favorite and DefaultFavuorite Entity.so how can i store the data
spring spring-boot spring-data-jpa
"id" :"3",
"userId": "abc",
"favName": "shashank",
"kpiName": "FavKPI",
"rptId": "529",
"language": "EN",
"selectedControlIdList": [
"favouriteId": 3,
"controlId": "3",
"controlName": " ",
"label": "Plant",
"keyValue": "KPI_01_PL_01_1",
"structureType": "LISTBOX"
,
"favouriteId": 3,
"controlId": "2",
"controlName": " ",
"label": "Plant12",
"keyValue": "KPI_01",
"structureType": "LISTBOX"
]
My controller class is
@RequestMapping(value = "/addFavData", method = RequestMethod.POST, consumes =MediaType.APPLICATION_JSON_VALUE, produces =MediaType.APPLICATION_JSON_VALUE)
public void addFavData(@RequestBody FavouriteDTO requestInputMapper)
favouriteService.addFavouriteData(requestInputMapper);
service class
public void addFavouriteData(FavouriteDTO requestInputMapper)
favouriteRepository.save(requestInputMapper);
And these are entity class !!
@Entity
@Table(name = "favorite", schema = "quality")
public class FavouriteDTO implements Serializable
private static final long serialVersionUID = -7089417397407966229L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "userId")
private String userId;
@Column(name = "favName")
private String favName;
@Column(name = "kpiName")
private String kpiName;
@Column(name = "rptId")
private String rptId;
@Column(name = "language")
private String language;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "favouriteId")
private List<DefaultControlsDTO> selectedControlIdList;
And
@Entity
@Table(name = "favoriteControls", schema = "quality")
public class DefaultControlsDTO implements Serializable
private static final long serialVersionUID = 8720721227933753311L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "favouriteId")
private Integer favouriteId;
@Column(name = "controlId")
private String controlId;
@Column(name = "controlName")
private String controlName;
@Column(name = "label")
private String label;
@Column(name = "keyValue")
private String keyValue;
@Column(name = "structureType")
private String structureType;
here the id is auto genrated. and the favouriteId is same as id.
so how can i store the data as id is auto genrated and i need to put the same favourite id as in id. so how can i store the data in the data base
so i have given my entity class. i have two entity Favorite and DefaultFavuorite Entity.so how can i store the data
spring spring-boot spring-data-jpa
spring spring-boot spring-data-jpa
edited Nov 12 at 13:38
BalusC
839k29531103189
839k29531103189
asked Nov 12 at 5:32
Shashank Ranjan
65
65
2
What have you done yet?
– Alex Foglia
Nov 12 at 5:37
i have created the data model and then through save method i am calling
– Shashank Ranjan
Nov 12 at 5:46
controller--> service--->Repo <myEntiyclass, Integer>
– Shashank Ranjan
Nov 12 at 5:47
please share your code
– rockyBalboa
Nov 12 at 5:48
controller class @RequestMapping(value = "/addFavData", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public void addFavData(@RequestBody FavouriteDTO requestInputMapper) favouriteService.addFavouriteData(requestInputMapper);
– Shashank Ranjan
Nov 12 at 5:55
|
show 8 more comments
2
What have you done yet?
– Alex Foglia
Nov 12 at 5:37
i have created the data model and then through save method i am calling
– Shashank Ranjan
Nov 12 at 5:46
controller--> service--->Repo <myEntiyclass, Integer>
– Shashank Ranjan
Nov 12 at 5:47
please share your code
– rockyBalboa
Nov 12 at 5:48
controller class @RequestMapping(value = "/addFavData", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public void addFavData(@RequestBody FavouriteDTO requestInputMapper) favouriteService.addFavouriteData(requestInputMapper);
– Shashank Ranjan
Nov 12 at 5:55
2
2
What have you done yet?
– Alex Foglia
Nov 12 at 5:37
What have you done yet?
– Alex Foglia
Nov 12 at 5:37
i have created the data model and then through save method i am calling
– Shashank Ranjan
Nov 12 at 5:46
i have created the data model and then through save method i am calling
– Shashank Ranjan
Nov 12 at 5:46
controller--> service--->Repo <myEntiyclass, Integer>
– Shashank Ranjan
Nov 12 at 5:47
controller--> service--->Repo <myEntiyclass, Integer>
– Shashank Ranjan
Nov 12 at 5:47
please share your code
– rockyBalboa
Nov 12 at 5:48
please share your code
– rockyBalboa
Nov 12 at 5:48
controller class @RequestMapping(value = "/addFavData", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public void addFavData(@RequestBody FavouriteDTO requestInputMapper) favouriteService.addFavouriteData(requestInputMapper);
– Shashank Ranjan
Nov 12 at 5:55
controller class @RequestMapping(value = "/addFavData", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public void addFavData(@RequestBody FavouriteDTO requestInputMapper) favouriteService.addFavouriteData(requestInputMapper);
– Shashank Ranjan
Nov 12 at 5:55
|
show 8 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
You can tell Hibernate, and any other JPA implementation, to cascade certain operations you perform on an entity to its associated child entities. The only thing you have to do is to define the kind of operation you want to cascade to the child entities.
The following code snippet shows an example in which I cascade the persist operation of the Author entity to all associated Book entities.
@Entity
public class Author
…
@ManyToMany(mappedBy=”authors”, cascade = CascadeType.PERSIST)
private List<Book> books = new ArrayList<Book>();
…
When you now create a new Author and several associated Book entities, you just have to persist the Author entity.
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
Author a = new Author();
a.setFirstName(“John”);
a.setLastName(“Doe”);
Book b1 = new Book();
b1.setTitle(“John’s first book”);
a.getBooks().add(b1);
Book b2 = new Book();
b2.setTitle(“John’s second book”);
a.getBooks().add(b2);
em.persist(a);
em.getTransaction().commit();
em.close();
As you can see in the log output, Hibernate cascades the operation to the associated Book entities and persists them as well.
15:44:28,140 DEBUG [org.hibernate.SQL] – insert into Author (firstName, lastName, version, id) values (?, ?, ?, ?)
15:44:28,147 DEBUG [org.hibernate.SQL] – insert into Book (publisherid, publishingDate, title, version, id) values (?, ?, ?, ?, ?)
15:44:28,150 DEBUG [org.hibernate.SQL] – insert into Book (publisherid, publishingDate, title, version, id) values (?, ?, ?, ?, ?)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53256395%2fi-want-to-store-the-json-using-spring-boot-with-jpa%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You can tell Hibernate, and any other JPA implementation, to cascade certain operations you perform on an entity to its associated child entities. The only thing you have to do is to define the kind of operation you want to cascade to the child entities.
The following code snippet shows an example in which I cascade the persist operation of the Author entity to all associated Book entities.
@Entity
public class Author
…
@ManyToMany(mappedBy=”authors”, cascade = CascadeType.PERSIST)
private List<Book> books = new ArrayList<Book>();
…
When you now create a new Author and several associated Book entities, you just have to persist the Author entity.
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
Author a = new Author();
a.setFirstName(“John”);
a.setLastName(“Doe”);
Book b1 = new Book();
b1.setTitle(“John’s first book”);
a.getBooks().add(b1);
Book b2 = new Book();
b2.setTitle(“John’s second book”);
a.getBooks().add(b2);
em.persist(a);
em.getTransaction().commit();
em.close();
As you can see in the log output, Hibernate cascades the operation to the associated Book entities and persists them as well.
15:44:28,140 DEBUG [org.hibernate.SQL] – insert into Author (firstName, lastName, version, id) values (?, ?, ?, ?)
15:44:28,147 DEBUG [org.hibernate.SQL] – insert into Book (publisherid, publishingDate, title, version, id) values (?, ?, ?, ?, ?)
15:44:28,150 DEBUG [org.hibernate.SQL] – insert into Book (publisherid, publishingDate, title, version, id) values (?, ?, ?, ?, ?)
add a comment |
up vote
0
down vote
You can tell Hibernate, and any other JPA implementation, to cascade certain operations you perform on an entity to its associated child entities. The only thing you have to do is to define the kind of operation you want to cascade to the child entities.
The following code snippet shows an example in which I cascade the persist operation of the Author entity to all associated Book entities.
@Entity
public class Author
…
@ManyToMany(mappedBy=”authors”, cascade = CascadeType.PERSIST)
private List<Book> books = new ArrayList<Book>();
…
When you now create a new Author and several associated Book entities, you just have to persist the Author entity.
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
Author a = new Author();
a.setFirstName(“John”);
a.setLastName(“Doe”);
Book b1 = new Book();
b1.setTitle(“John’s first book”);
a.getBooks().add(b1);
Book b2 = new Book();
b2.setTitle(“John’s second book”);
a.getBooks().add(b2);
em.persist(a);
em.getTransaction().commit();
em.close();
As you can see in the log output, Hibernate cascades the operation to the associated Book entities and persists them as well.
15:44:28,140 DEBUG [org.hibernate.SQL] – insert into Author (firstName, lastName, version, id) values (?, ?, ?, ?)
15:44:28,147 DEBUG [org.hibernate.SQL] – insert into Book (publisherid, publishingDate, title, version, id) values (?, ?, ?, ?, ?)
15:44:28,150 DEBUG [org.hibernate.SQL] – insert into Book (publisherid, publishingDate, title, version, id) values (?, ?, ?, ?, ?)
add a comment |
up vote
0
down vote
up vote
0
down vote
You can tell Hibernate, and any other JPA implementation, to cascade certain operations you perform on an entity to its associated child entities. The only thing you have to do is to define the kind of operation you want to cascade to the child entities.
The following code snippet shows an example in which I cascade the persist operation of the Author entity to all associated Book entities.
@Entity
public class Author
…
@ManyToMany(mappedBy=”authors”, cascade = CascadeType.PERSIST)
private List<Book> books = new ArrayList<Book>();
…
When you now create a new Author and several associated Book entities, you just have to persist the Author entity.
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
Author a = new Author();
a.setFirstName(“John”);
a.setLastName(“Doe”);
Book b1 = new Book();
b1.setTitle(“John’s first book”);
a.getBooks().add(b1);
Book b2 = new Book();
b2.setTitle(“John’s second book”);
a.getBooks().add(b2);
em.persist(a);
em.getTransaction().commit();
em.close();
As you can see in the log output, Hibernate cascades the operation to the associated Book entities and persists them as well.
15:44:28,140 DEBUG [org.hibernate.SQL] – insert into Author (firstName, lastName, version, id) values (?, ?, ?, ?)
15:44:28,147 DEBUG [org.hibernate.SQL] – insert into Book (publisherid, publishingDate, title, version, id) values (?, ?, ?, ?, ?)
15:44:28,150 DEBUG [org.hibernate.SQL] – insert into Book (publisherid, publishingDate, title, version, id) values (?, ?, ?, ?, ?)
You can tell Hibernate, and any other JPA implementation, to cascade certain operations you perform on an entity to its associated child entities. The only thing you have to do is to define the kind of operation you want to cascade to the child entities.
The following code snippet shows an example in which I cascade the persist operation of the Author entity to all associated Book entities.
@Entity
public class Author
…
@ManyToMany(mappedBy=”authors”, cascade = CascadeType.PERSIST)
private List<Book> books = new ArrayList<Book>();
…
When you now create a new Author and several associated Book entities, you just have to persist the Author entity.
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
Author a = new Author();
a.setFirstName(“John”);
a.setLastName(“Doe”);
Book b1 = new Book();
b1.setTitle(“John’s first book”);
a.getBooks().add(b1);
Book b2 = new Book();
b2.setTitle(“John’s second book”);
a.getBooks().add(b2);
em.persist(a);
em.getTransaction().commit();
em.close();
As you can see in the log output, Hibernate cascades the operation to the associated Book entities and persists them as well.
15:44:28,140 DEBUG [org.hibernate.SQL] – insert into Author (firstName, lastName, version, id) values (?, ?, ?, ?)
15:44:28,147 DEBUG [org.hibernate.SQL] – insert into Book (publisherid, publishingDate, title, version, id) values (?, ?, ?, ?, ?)
15:44:28,150 DEBUG [org.hibernate.SQL] – insert into Book (publisherid, publishingDate, title, version, id) values (?, ?, ?, ?, ?)
answered Nov 12 at 6:20
vishal lakhyani
694
694
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53256395%2fi-want-to-store-the-json-using-spring-boot-with-jpa%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
What have you done yet?
– Alex Foglia
Nov 12 at 5:37
i have created the data model and then through save method i am calling
– Shashank Ranjan
Nov 12 at 5:46
controller--> service--->Repo <myEntiyclass, Integer>
– Shashank Ranjan
Nov 12 at 5:47
please share your code
– rockyBalboa
Nov 12 at 5:48
controller class @RequestMapping(value = "/addFavData", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public void addFavData(@RequestBody FavouriteDTO requestInputMapper) favouriteService.addFavouriteData(requestInputMapper);
– Shashank Ranjan
Nov 12 at 5:55