hibernate - konnte nicht ausgeführt statement; SQL [n/a] - speichern verschachtelter Objekte

Ich bin versucht zu retten, eine verschachtelte Objekt mit hibernate und ich bekomme could not execute statement; SQL [n/a] Exception

CODE

@Entity
@Table(name = "listing")
@Inheritance(strategy = InheritanceType.JOINED)
public class Listing implements Serializable {

  @Id
  @Column(name = "listing_id")
  private String listingId;

  @Column(name = "property_type")
  private PropertyType propertyType;

  @Column(name = "category")
  private Category category;

  @Column(name = "price_currency")
  private String priceCurrency;

  @Column(name = "price_value")
  private Double priceValue;

  @Column(name = "map_point")
  private MapPoint mapPoint;

  @Column(name = "commission_fee_info")
  private CommissionFeeInfo commissionFeeInfo;
}


public class MapPoint implements Serializable {

  private final float latitude;
  private final float longitude;
}

public class CommissionFeeInfo implements Serializable {

  private String agentFeeInfo;
  private CommissionFeeType commissionFeeType;
  private Double value;
  private Double commissionFee;
}

public enum CommissionFeeType implements Serializable { }

Mit RazorSQL ich sah, dass hibernate definiert MapPoint und CommissionFee als VARBINARY

Was ich nicht verstehen kann, ist die Tatsache, dass hibernate verwaltet, es zu speichern, wenn commissionFeeInfo ist nicht vorhanden. Es hat keine problem mit speichern MapPoint

Hat jemand eine Idee, was ich falsch mache?

UPDATE

Fand ich heraus, dass wenn alle Attribute von CommissionFeeInfo ausgenommen agentFeeInfosind null ist, wird das Objekt gespeichert, ohne Probleme. Wenn eines der anderen Attribute ist != null, tritt der Fehler auf.

UPDATE 2

Änderte ich den Typ aller Attribute CommissionFeeInfo in String, und das Objekt wird gespeichert, ohne problem, aber ich kann nicht zulassen, dass die Attribute als String.

Können Sie erklären, mehr der Fehler, den Sie haben? Es gibt verschachtelte Ausnahme? Jede SQL-Fehler-code?
ja, es gibt eine geschachtelte Ausnahmen java.sql.SQLDataException: data exception: string data, right truncation; table: LISTING column: COMMISSION_FEE_INFO
und auch org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement und sql = n/a

InformationsquelleAutor Paul | 2015-08-05

Schreibe einen Kommentar