How to enum mapping with jpa Spring boot why not save enum value in DB in DB saving enum key
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Version;
import org.hibernate.annotations.GenericGenerator;
import com.lue.billingsystem.enums.Status;
import com.lue.billingsystem.enums.Types;
@Entity
@Table(name="product_tab")
public class Product implements Serializable{
private static final long serialVersionUID = 8919320309645697466L;
@Id
@Column(name="prod_id",updatable=false)
@GenericGenerator(name="product_tab_genetator",strategy="increment")
@GeneratedValue(generator="product_tab_genetator")
private Long id;
private String name;
@Enumerated(EnumType.STRING)
@Column(name = "type")
private Types type;
@Column(name = "status")
@Enumerated(EnumType.STRING)
private Status status;
@Column(name = "description", length = 200)
private String description;
@OneToMany(mappedBy="product")
private List<Charge> charges;
@Column(name = "create_date", columnDefinition = "DATETIME")
private Date createDate;
@Column(name = "update_date", columnDefinition = "DATETIME")
private Date updateDate;
//@Version
private Integer version;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Types getType() {
return type;
}
public void setType(Types type) {
this.type = type;
}
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<Charge> getCharges() {
return charges;
}
public void setCharges(List<Charge> charges) {
this.charges = charges;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
}
import org.springframework.http.HttpStatus;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.lue.billingsystem.enums.utils.StatusDeserializer;
import com.lue.billingsystem.exception.BillingException;
@JsonDeserialize(using = StatusDeserializer.class)
public enum Status {
ACTIVE("Active"), INACTIVE("Inactive");
private final String text;
Status(final String text) {
this.text = text;
}
@Override
public String toString() {
return text;
}
public String getText() {
return this.text;
}
public static Status fromText(String text) {
for (Status r : Status.values()) {
if (r.getText().equals(text)) {
System.out.println(r);
return r;
}
}
throw new BillingException("Your Status not valied: "+text +" ", HttpStatus.BAD_REQUEST, 400);
}
}
import java.io.IOException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
import com.lue.billingsystem.enums.Status;
public class StatusDeserializer extends JsonDeserializer<Status> {
@Override
public Status deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException, JsonProcessingException {
ObjectCodec oc = jsonParser.getCodec();
JsonNode node = oc.readTree(jsonParser);
if (node == null) {
return null;
}
String text = node.textValue(); // gives "A" from the request
if (text == null) {
return null;
}
//System.out.println(Status.fromText(text) + "---------------");
return Status.fromText(text);
}
}
How to enum mapping with jpa Spring boot why not save enum value in DB in DB saving enum key when i saving product in databse not save status like Active it always save ACTIVE
java spring-boot spring-data-jpa
add a comment |
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Version;
import org.hibernate.annotations.GenericGenerator;
import com.lue.billingsystem.enums.Status;
import com.lue.billingsystem.enums.Types;
@Entity
@Table(name="product_tab")
public class Product implements Serializable{
private static final long serialVersionUID = 8919320309645697466L;
@Id
@Column(name="prod_id",updatable=false)
@GenericGenerator(name="product_tab_genetator",strategy="increment")
@GeneratedValue(generator="product_tab_genetator")
private Long id;
private String name;
@Enumerated(EnumType.STRING)
@Column(name = "type")
private Types type;
@Column(name = "status")
@Enumerated(EnumType.STRING)
private Status status;
@Column(name = "description", length = 200)
private String description;
@OneToMany(mappedBy="product")
private List<Charge> charges;
@Column(name = "create_date", columnDefinition = "DATETIME")
private Date createDate;
@Column(name = "update_date", columnDefinition = "DATETIME")
private Date updateDate;
//@Version
private Integer version;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Types getType() {
return type;
}
public void setType(Types type) {
this.type = type;
}
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<Charge> getCharges() {
return charges;
}
public void setCharges(List<Charge> charges) {
this.charges = charges;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
}
import org.springframework.http.HttpStatus;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.lue.billingsystem.enums.utils.StatusDeserializer;
import com.lue.billingsystem.exception.BillingException;
@JsonDeserialize(using = StatusDeserializer.class)
public enum Status {
ACTIVE("Active"), INACTIVE("Inactive");
private final String text;
Status(final String text) {
this.text = text;
}
@Override
public String toString() {
return text;
}
public String getText() {
return this.text;
}
public static Status fromText(String text) {
for (Status r : Status.values()) {
if (r.getText().equals(text)) {
System.out.println(r);
return r;
}
}
throw new BillingException("Your Status not valied: "+text +" ", HttpStatus.BAD_REQUEST, 400);
}
}
import java.io.IOException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
import com.lue.billingsystem.enums.Status;
public class StatusDeserializer extends JsonDeserializer<Status> {
@Override
public Status deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException, JsonProcessingException {
ObjectCodec oc = jsonParser.getCodec();
JsonNode node = oc.readTree(jsonParser);
if (node == null) {
return null;
}
String text = node.textValue(); // gives "A" from the request
if (text == null) {
return null;
}
//System.out.println(Status.fromText(text) + "---------------");
return Status.fromText(text);
}
}
How to enum mapping with jpa Spring boot why not save enum value in DB in DB saving enum key when i saving product in databse not save status like Active it always save ACTIVE
java spring-boot spring-data-jpa
2
Repeating your question four times to get around the 'too little text' pop up, isn't making your question any clearer. Please instead elaborate on your problem and give a description.
– Codeer
Jan 3 at 11:03
Google for "JPA AttributeConverter".
– JB Nizet
Jan 3 at 11:07
add a comment |
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Version;
import org.hibernate.annotations.GenericGenerator;
import com.lue.billingsystem.enums.Status;
import com.lue.billingsystem.enums.Types;
@Entity
@Table(name="product_tab")
public class Product implements Serializable{
private static final long serialVersionUID = 8919320309645697466L;
@Id
@Column(name="prod_id",updatable=false)
@GenericGenerator(name="product_tab_genetator",strategy="increment")
@GeneratedValue(generator="product_tab_genetator")
private Long id;
private String name;
@Enumerated(EnumType.STRING)
@Column(name = "type")
private Types type;
@Column(name = "status")
@Enumerated(EnumType.STRING)
private Status status;
@Column(name = "description", length = 200)
private String description;
@OneToMany(mappedBy="product")
private List<Charge> charges;
@Column(name = "create_date", columnDefinition = "DATETIME")
private Date createDate;
@Column(name = "update_date", columnDefinition = "DATETIME")
private Date updateDate;
//@Version
private Integer version;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Types getType() {
return type;
}
public void setType(Types type) {
this.type = type;
}
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<Charge> getCharges() {
return charges;
}
public void setCharges(List<Charge> charges) {
this.charges = charges;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
}
import org.springframework.http.HttpStatus;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.lue.billingsystem.enums.utils.StatusDeserializer;
import com.lue.billingsystem.exception.BillingException;
@JsonDeserialize(using = StatusDeserializer.class)
public enum Status {
ACTIVE("Active"), INACTIVE("Inactive");
private final String text;
Status(final String text) {
this.text = text;
}
@Override
public String toString() {
return text;
}
public String getText() {
return this.text;
}
public static Status fromText(String text) {
for (Status r : Status.values()) {
if (r.getText().equals(text)) {
System.out.println(r);
return r;
}
}
throw new BillingException("Your Status not valied: "+text +" ", HttpStatus.BAD_REQUEST, 400);
}
}
import java.io.IOException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
import com.lue.billingsystem.enums.Status;
public class StatusDeserializer extends JsonDeserializer<Status> {
@Override
public Status deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException, JsonProcessingException {
ObjectCodec oc = jsonParser.getCodec();
JsonNode node = oc.readTree(jsonParser);
if (node == null) {
return null;
}
String text = node.textValue(); // gives "A" from the request
if (text == null) {
return null;
}
//System.out.println(Status.fromText(text) + "---------------");
return Status.fromText(text);
}
}
How to enum mapping with jpa Spring boot why not save enum value in DB in DB saving enum key when i saving product in databse not save status like Active it always save ACTIVE
java spring-boot spring-data-jpa
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Version;
import org.hibernate.annotations.GenericGenerator;
import com.lue.billingsystem.enums.Status;
import com.lue.billingsystem.enums.Types;
@Entity
@Table(name="product_tab")
public class Product implements Serializable{
private static final long serialVersionUID = 8919320309645697466L;
@Id
@Column(name="prod_id",updatable=false)
@GenericGenerator(name="product_tab_genetator",strategy="increment")
@GeneratedValue(generator="product_tab_genetator")
private Long id;
private String name;
@Enumerated(EnumType.STRING)
@Column(name = "type")
private Types type;
@Column(name = "status")
@Enumerated(EnumType.STRING)
private Status status;
@Column(name = "description", length = 200)
private String description;
@OneToMany(mappedBy="product")
private List<Charge> charges;
@Column(name = "create_date", columnDefinition = "DATETIME")
private Date createDate;
@Column(name = "update_date", columnDefinition = "DATETIME")
private Date updateDate;
//@Version
private Integer version;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Types getType() {
return type;
}
public void setType(Types type) {
this.type = type;
}
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<Charge> getCharges() {
return charges;
}
public void setCharges(List<Charge> charges) {
this.charges = charges;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
}
import org.springframework.http.HttpStatus;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.lue.billingsystem.enums.utils.StatusDeserializer;
import com.lue.billingsystem.exception.BillingException;
@JsonDeserialize(using = StatusDeserializer.class)
public enum Status {
ACTIVE("Active"), INACTIVE("Inactive");
private final String text;
Status(final String text) {
this.text = text;
}
@Override
public String toString() {
return text;
}
public String getText() {
return this.text;
}
public static Status fromText(String text) {
for (Status r : Status.values()) {
if (r.getText().equals(text)) {
System.out.println(r);
return r;
}
}
throw new BillingException("Your Status not valied: "+text +" ", HttpStatus.BAD_REQUEST, 400);
}
}
import java.io.IOException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
import com.lue.billingsystem.enums.Status;
public class StatusDeserializer extends JsonDeserializer<Status> {
@Override
public Status deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException, JsonProcessingException {
ObjectCodec oc = jsonParser.getCodec();
JsonNode node = oc.readTree(jsonParser);
if (node == null) {
return null;
}
String text = node.textValue(); // gives "A" from the request
if (text == null) {
return null;
}
//System.out.println(Status.fromText(text) + "---------------");
return Status.fromText(text);
}
}
How to enum mapping with jpa Spring boot why not save enum value in DB in DB saving enum key when i saving product in databse not save status like Active it always save ACTIVE
java spring-boot spring-data-jpa
java spring-boot spring-data-jpa
edited Jan 3 at 11:28
Tim Diekmann
3,41791937
3,41791937
asked Jan 3 at 10:58


kaushal kumarkaushal kumar
61
61
2
Repeating your question four times to get around the 'too little text' pop up, isn't making your question any clearer. Please instead elaborate on your problem and give a description.
– Codeer
Jan 3 at 11:03
Google for "JPA AttributeConverter".
– JB Nizet
Jan 3 at 11:07
add a comment |
2
Repeating your question four times to get around the 'too little text' pop up, isn't making your question any clearer. Please instead elaborate on your problem and give a description.
– Codeer
Jan 3 at 11:03
Google for "JPA AttributeConverter".
– JB Nizet
Jan 3 at 11:07
2
2
Repeating your question four times to get around the 'too little text' pop up, isn't making your question any clearer. Please instead elaborate on your problem and give a description.
– Codeer
Jan 3 at 11:03
Repeating your question four times to get around the 'too little text' pop up, isn't making your question any clearer. Please instead elaborate on your problem and give a description.
– Codeer
Jan 3 at 11:03
Google for "JPA AttributeConverter".
– JB Nizet
Jan 3 at 11:07
Google for "JPA AttributeConverter".
– JB Nizet
Jan 3 at 11:07
add a comment |
1 Answer
1
active
oldest
votes
You just need to pay attention to the enum values when the table is being created.
What are the enum values in the table e.g. in status column, are the values defined as 'Active', 'Inactive'
or 'ACTIVE', 'INACTIVE'
. That's what will determine the value saved.
If the enum values are defined as 'ACTIVE', 'INACTIVE'
, if you insert 'active' as the value for status, it will change to 'ACTIVE' inside the database because it inserts based on the pre defined enum values.
thanks for answer , but in i have some different enum like public enum AccountType { RESIDENTIAL_ACCOUNT("Residential account"), BUSINESS_ACCOUNT("Business account"), SUNDRY_ACCOUNT("Sundry account"); } How to write this type enum please help me
– kaushal kumar
Jan 4 at 5:12
I mean the enum definition in your database tables, not in your code.
– Olantobi
Jan 4 at 6:04
stackoverflow.com/questions/7766791/…
– kaushal kumar
Jan 8 at 10:28
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%2f54020974%2fhow-to-enum-mapping-with-jpa-spring-boot-why-not-save-enum-value-in-db-in-db-sav%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
You just need to pay attention to the enum values when the table is being created.
What are the enum values in the table e.g. in status column, are the values defined as 'Active', 'Inactive'
or 'ACTIVE', 'INACTIVE'
. That's what will determine the value saved.
If the enum values are defined as 'ACTIVE', 'INACTIVE'
, if you insert 'active' as the value for status, it will change to 'ACTIVE' inside the database because it inserts based on the pre defined enum values.
thanks for answer , but in i have some different enum like public enum AccountType { RESIDENTIAL_ACCOUNT("Residential account"), BUSINESS_ACCOUNT("Business account"), SUNDRY_ACCOUNT("Sundry account"); } How to write this type enum please help me
– kaushal kumar
Jan 4 at 5:12
I mean the enum definition in your database tables, not in your code.
– Olantobi
Jan 4 at 6:04
stackoverflow.com/questions/7766791/…
– kaushal kumar
Jan 8 at 10:28
add a comment |
You just need to pay attention to the enum values when the table is being created.
What are the enum values in the table e.g. in status column, are the values defined as 'Active', 'Inactive'
or 'ACTIVE', 'INACTIVE'
. That's what will determine the value saved.
If the enum values are defined as 'ACTIVE', 'INACTIVE'
, if you insert 'active' as the value for status, it will change to 'ACTIVE' inside the database because it inserts based on the pre defined enum values.
thanks for answer , but in i have some different enum like public enum AccountType { RESIDENTIAL_ACCOUNT("Residential account"), BUSINESS_ACCOUNT("Business account"), SUNDRY_ACCOUNT("Sundry account"); } How to write this type enum please help me
– kaushal kumar
Jan 4 at 5:12
I mean the enum definition in your database tables, not in your code.
– Olantobi
Jan 4 at 6:04
stackoverflow.com/questions/7766791/…
– kaushal kumar
Jan 8 at 10:28
add a comment |
You just need to pay attention to the enum values when the table is being created.
What are the enum values in the table e.g. in status column, are the values defined as 'Active', 'Inactive'
or 'ACTIVE', 'INACTIVE'
. That's what will determine the value saved.
If the enum values are defined as 'ACTIVE', 'INACTIVE'
, if you insert 'active' as the value for status, it will change to 'ACTIVE' inside the database because it inserts based on the pre defined enum values.
You just need to pay attention to the enum values when the table is being created.
What are the enum values in the table e.g. in status column, are the values defined as 'Active', 'Inactive'
or 'ACTIVE', 'INACTIVE'
. That's what will determine the value saved.
If the enum values are defined as 'ACTIVE', 'INACTIVE'
, if you insert 'active' as the value for status, it will change to 'ACTIVE' inside the database because it inserts based on the pre defined enum values.
answered Jan 3 at 13:51
OlantobiOlantobi
6141714
6141714
thanks for answer , but in i have some different enum like public enum AccountType { RESIDENTIAL_ACCOUNT("Residential account"), BUSINESS_ACCOUNT("Business account"), SUNDRY_ACCOUNT("Sundry account"); } How to write this type enum please help me
– kaushal kumar
Jan 4 at 5:12
I mean the enum definition in your database tables, not in your code.
– Olantobi
Jan 4 at 6:04
stackoverflow.com/questions/7766791/…
– kaushal kumar
Jan 8 at 10:28
add a comment |
thanks for answer , but in i have some different enum like public enum AccountType { RESIDENTIAL_ACCOUNT("Residential account"), BUSINESS_ACCOUNT("Business account"), SUNDRY_ACCOUNT("Sundry account"); } How to write this type enum please help me
– kaushal kumar
Jan 4 at 5:12
I mean the enum definition in your database tables, not in your code.
– Olantobi
Jan 4 at 6:04
stackoverflow.com/questions/7766791/…
– kaushal kumar
Jan 8 at 10:28
thanks for answer , but in i have some different enum like public enum AccountType { RESIDENTIAL_ACCOUNT("Residential account"), BUSINESS_ACCOUNT("Business account"), SUNDRY_ACCOUNT("Sundry account"); } How to write this type enum please help me
– kaushal kumar
Jan 4 at 5:12
thanks for answer , but in i have some different enum like public enum AccountType { RESIDENTIAL_ACCOUNT("Residential account"), BUSINESS_ACCOUNT("Business account"), SUNDRY_ACCOUNT("Sundry account"); } How to write this type enum please help me
– kaushal kumar
Jan 4 at 5:12
I mean the enum definition in your database tables, not in your code.
– Olantobi
Jan 4 at 6:04
I mean the enum definition in your database tables, not in your code.
– Olantobi
Jan 4 at 6:04
stackoverflow.com/questions/7766791/…
– kaushal kumar
Jan 8 at 10:28
stackoverflow.com/questions/7766791/…
– kaushal kumar
Jan 8 at 10:28
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.
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%2f54020974%2fhow-to-enum-mapping-with-jpa-spring-boot-why-not-save-enum-value-in-db-in-db-sav%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
Repeating your question four times to get around the 'too little text' pop up, isn't making your question any clearer. Please instead elaborate on your problem and give a description.
– Codeer
Jan 3 at 11:03
Google for "JPA AttributeConverter".
– JB Nizet
Jan 3 at 11:07