Estoy haciendo unas practicas de Spring Data JPA y MySQL para poder familiarizarme un poco con Spring. Estoy creando las tablas de mi base de datos (2 de ellas se generaron correctamente) pero la tercera siempre me da el siguiente error:
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table order_item (id_item integer not null, id_order integer not null, id_pizza integer not null, price DECIMAL(5,2) not null, quantity DECIMAL(3,1 not null, primary key (id_item, id_order)) 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 'not null, primary key (id_item, id_order)) engine=InnoDB' at line 1]
El codigo que tengo es el que esta a continuación:
import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "order_item")
@Getter
@Setter
@IdClass(OrderItemId.class)
@NoArgsConstructor
public class OrderItemEntity {
@Id
@Column(name = "id_item", nullable = false)
private Integer idItem;
@Id
@Column(name = "id_order", nullable = false)
private Integer idOrder;
@Column(name = "id_pizza", nullable = false)
private Integer idPizza;
@Column(nullable = false, columnDefinition = "DECIMAL(3,1")
private Double quantity;
@Column(nullable = false, columnDefinition = "DECIMAL(5,2)")
private Double price;
@OneToOne
@JoinColumn(name = "id_pizza", referencedColumnName = "id_pizza", insertable = false,
updatable = false)
private PizzaEntity pizza;
@ManyToOne
@JoinColumn(name = "id_order", referencedColumnName = "id_order", insertable = false, updatable = false)
private OrderEntity order;
}
Estoy usando la version 17.10 de JDK y la version 8.0 de MySQL Workbench.