@Entity
@Table(name = "order")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Order implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
private CompositeKey key;
private OrderStatus orderStatus;
private Currency currency;
private LocalDateTime orderDateTime;
private Integer orderQuantity;
private Double totalPrice;
}
< /code>
@Data
@AllArgsConstructor
@NoArgsConstructor
@Embeddable
public class CompositeKey implements Serializable{
private static final long serialVersionUID = 1L;
private Integer userId;
private Integer productId;
private Integer transactionId;
private Integer paymentSessionId;
}
< /code>
this is giving me this Exception
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table order (currency varchar(3), order_quantity integer, order_status tinyint check (order_status between 0 and 5), payment_session_id integer not null, product_id integer not null, total_price float(53), transaction_id integer not null, user_id integer not null, order_date_time datetime(6), primary key (payment_session_id, product_id, transaction_id, user_id)) engine=InnoDB" via JDBC [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (currency varchar(3), order_quantity integer, order_status tinyint check
what is the main problem? currently I am using mysql.
Подробнее здесь: https://stackoverflow.com/questions/795 ... g-data-jpa