I'm implementing the interface UserDetails
that have some methods. All of them return a boolean, such as:
public boolean isAccountNonExpired();
In Oracle do not exists BOOLEAN
type as SQL column table attribute, so i have to define this as VARCHAR2(1)
.
I'm my class (that implements UserDetails
) i've defined the field accountNonExpired as String (instead of boolean).
So, the isAccountNonExpired() is like this:
@Column(name = "Account_Non_Expired")
@Override
@XmlElement @JsonProperty
public boolean isAccountNonExpired()
{
return new Boolean(this.accountNonExpired);
}
When i try to execute login (and repository query the table), i get the following error:
HHH000123: IllegalArgumentException in class: it.dirimologistika.site.entities.UserPrincipal, setter method of property: accountNonExpired
HHH000091: Expected type: java.lang.String, actual value: java.lang.Boolean
How i have to rewrite this class (and implements this method) using a VARCHAR2(1) instead of BOOLEAN? This is natural in MySQL, but in Oracle.. ?
This is a JPA / Hibernate question, it's not specific to spring security.
See https://stackoverflow.com/a/22368268/2257772 for a pure JPA implementation or the other comments for the hibernate one.
You should change the tag / title of your question
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.