user3629015 user3629015 - 1 month ago 5x
Java Question

JavaFX Hibernate MappingException

Starting to work with JavaFX and hibernate, but can't resolve this exception:

Caused by: org.hibernate.MappingException: Could not determine type for:, at table: User, for columns: [org.hibernate.mapping.Column(answerProperty)]
at org.hibernate.mapping.SimpleValue.getType(
at org.hibernate.mapping.SimpleValue.isValid(
at org.hibernate.mapping.Property.isValid(
at org.hibernate.mapping.PersistentClass.validate(
at org.hibernate.mapping.RootClass.validate(
at org.hibernate.cfg.Configuration.validate(
at org.hibernate.cfg.Configuration.buildSessionFactory(
at t093760.diploma.MainApp.start(
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(
at com.sun.javafx.application.LauncherImpl$$Lambda$53/ Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(
at com.sun.javafx.application.PlatformImpl$$Lambda$46/ Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$170(
at com.sun.javafx.application.PlatformImpl$$Lambda$48/ Source)
at Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(
at com.sun.javafx.application.PlatformImpl$$Lambda$47/ Source)
at Method)
at$$Lambda$36/ Source)
... 1 more

This is my model code:

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;


@Access(value = AccessType.PROPERTY)
public class User {

private long id;
private StringProperty login;
private StringProperty email;
private StringProperty password;
private StringProperty picture;
private StringProperty answer;

public User(){

public User(String login,String email,String password,String picture,String answer){
this.login=new SimpleStringProperty(login); SimpleStringProperty(email);
this.password=new SimpleStringProperty(password);
this.picture=new SimpleStringProperty(picture);
this.answer=new SimpleStringProperty(answer);

public StringProperty getLoginProperty() {
return login;

public void setLogin(String login) {
this.login = new SimpleStringProperty(login);

public String getLogin(){
return this.login.get();

public StringProperty getEmailProperty() {
return email;

public void setEmail(String email) { = new SimpleStringProperty(email);

public String getEmail() {

public StringProperty getPasswordProperty() {
return password;

public void setPassword(String password) {
this.password = new SimpleStringProperty(password);

public String getPassword() {
return this.password.get();

public StringProperty getPictureProperty() {
return picture;

public void setPicture(String picture) {
this.picture = new SimpleStringProperty(picture);

public String getPicture() {
return this.picture.get();

public StringProperty getAnswerProperty() {
return answer;

public void setAnswer(String answer) {
this.answer = new SimpleStringProperty(answer);

public String getAnswer() {
return this.answer.get();

@GeneratedValue(strategy = GenerationType.AUTO)
public long getId(){
return id;


Suggestions found here on stackoverflow: tried to use
and tried to annotate fields/getters, but it doesn't make any difference. I'm using SQLite database.


You need to implement the JavaFX Property pattern correctly. Your get methods should return the underlying type, not the property type.

For example:

public class User {

    private final StringProperty login ; 

    public User(String login) {
        this.login = new SimpleStringProperty(login);

    public StringProperty loginProperty() {
        return login ;

    public final String getLogin() {
        return loginProperty().get();

    public final void setLogin(String login) {

If you really have a need to expose the property itself via a get method (and this is completely non-standard), you must force it not to be persisted to the database by annotating it as @Transient.