java 执行ddl语句,java - GenerationTarget遇到异常接受命令:执行DDL“创建表时出错 - 堆栈内存溢出...

在尝试使用Hibernate JPA在MariaDB上建立支付表和账户之间的关系时,遇到DDL执行错误。问题在于无法创建支付表,尽管连接表已经存在。错误提示表明在创建表'service_provider'时出现问题。支付类和账户类已定义了一对一和一对多的关系,但可能由于主键或引用列设置不正确导致问题。检查数据库配置、实体类的注解以及方言设置,确保它们与MariaDB兼容。
摘要由CSDN通过智能技术生成

我是Java EE的新手,正在尝试实现Hibernate JPA关系,但是未创建付款表之一并抛出以下错误,但是联接表存在:

GenerationTarget encountered exception accepting command : Error executing DDL "create table payments (reference varchar(255) not null, Status Pending, ThirdPartyReference varchar(255) not null, amount double precision not null, dateCompleted date, dateCreated date not null, description varchar(255), dueDate date, payer_PhoneNumber varchar(12) not null, specialReference varchar(14) not null, acctount_id bigint, primary key (reference)) engine=InnoDB" via JDBC Statement

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL

贝娄(Bellow)提供了付款课程的详细信息:

package Organization.Core.Gateway.entities;

import javax.persistence.*;

import javax.validation.constraints.NotNull;

import java.time.LocalDate;

@Entity (name= "payments")

public class Payment {

public Account getServiceProvider() {

return ServiceProvider;

}

public void setServiceProvider(Account serviceProvider) {

ServiceProvider = serviceProvider;

}

public double getAmount() {

return amount;

}

public void setAmount(double amount) {

this.amount = amount;

}

public String getThirdPartyReference() {

return ThirdPartyReference;

}

public void setThirdPartyReference(String thirdPartyReference) {

ThirdPartyReference = thirdPartyReference;

}

public String getReference() {

return reference;

}

public void setReference(String reference) {

this.reference = reference;

}

public String getDescription() {

return description;

}

public void setDescription(String description) {

this.description = description;

}

public String getSpecialReference() {

return specialReference;

}

public void setSpecialReference(String specialReference) {

this.specialReference = specialReference;

}

public String getStatus() {

return Status;

}

public void setStatus(String status) {

Status = status;

}

public String getPayer_PhoneNumber() {

return payer_PhoneNumber;

}

public void setPayer_PhoneNumber(String MSISDN) {

this.payer_PhoneNumber = MSISDN;

}

public LocalDate getDateCreated() {

return dateCreated;

}

public void setDateCreated(LocalDate dateCreated) {

this.dateCreated = dateCreated;

}

public LocalDate getDateCompleted() {

return dateCompleted;

}

public void setDateCompleted(LocalDate dateCompleted) {

this.dateCompleted = dateCompleted;

}

public LocalDate getDueDate() {

return dueDate;

}

public void setDueDate(LocalDate dueDate) {

this.dueDate = dueDate;

}

@OneToOne(targetEntity = Account.class, cascade = CascadeType.ALL)

@JoinColumn(name = "acctount_id", referencedColumnName = "Id")

private Account ServiceProvider;

private double amount;

@Column(unique = true, nullable = false)

private String ThirdPartyReference;

@Id

//@GeneratedValue(strategy = GenerationType.AUTO)

//@SequenceGenerator(name = "reference_generator", sequenceName = "PAY", allocationSize = 15)

private String reference;

private String description;

@Column(nullable = false, length = 14)

private String specialReference;

@Column(columnDefinition = "Pending")

private String Status;

@Column(nullable = false,length =12)

private String payer_PhoneNumber;

@Column(nullable = false)

private LocalDate dateCreated;

private LocalDate dateCompleted;

private LocalDate dueDate;

}

比帐户明细:

package Organization.Core.Gateway.entities;

import javax.persistence.*;

import javax.validation.constraints.NotNull;

import java.util.Set;

@Entity( name = "accounts")

@Inheritance(strategy = InheritanceType.JOINED)

public class Account {

@Override

public String toString() {

return "Account{" +

"Id=" + Id +

", FirstName='" + FirstName + '\'' +

", Surname='" + Surname + '\'' +

", Payments=" + Payments +

'}';

}

public Long getId() {

return Id;

}

public void setId(Long id) {

Id = id;

}

public String getFirstName() {

return FirstName;

}

public void setFirstName(String firstName) {

FirstName = firstName;

}

public String getSurname() {

return Surname;

}

public void setSurname(String surname) {

Surname = surname;

}

public Set getPayments() {

return Payments;

}

public void setPayments(Set payments) {

Payments = payments;

}

@javax.persistence.Id

@GeneratedValue(strategy = GenerationType.AUTO)

private Long Id;

@NotNull

private String FirstName;

@NotNull

private String Surname;

@OneToMany(targetEntity = Payment.class, fetch = FetchType.LAZY)

private Set Payments;

}

最后是我要访问的商家帐户:

package Organization.Core.Gateway.entities;

import javax.persistence.Column;

import javax.persistence.Entity;

@Entity(name = "merchants")

public class Merchant extends Account{

public int getMpesa_ServiceproviderCode() {

return mpesa_ServiceproviderCode;

}

public void setMpesa_ServiceproviderCode(int mpesa_ServiceproviderCode) {

this.mpesa_ServiceproviderCode = mpesa_ServiceproviderCode;

}

public String getOrganizationName() {

return organizationName;

}

public void setOrganizationName(String organizationName) {

this.organizationName = organizationName;

}

@Column(name = "providershortCode")

private int mpesa_ServiceproviderCode;

@Override

public String toString() {

return "Merchant{" +

"mpesa_ServiceproviderCode=" + mpesa_ServiceproviderCode +

", organizationName='" + organizationName + '\'' +

'}';

}

private String organizationName;

}

持久性文件详细信息

xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">

org.hibernate.jpa.HibernatePersistenceProvider

PS:我读了一些我试图更改方言的文章,因为我使用的是mariadb,甚至在这里也查看了文章。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值