Я хочу присоединиться к таблице, но это сообщение об ошибке шоу - PullRequest
0 голосов
/ 26 февраля 2020

, так что это сообщение об ошибке

Выполнено тестов: 1, сбоев: 0, ошибок: 1, пропущено: 0, истекло время: 2,823 с <<< НЕУДАЧИ! - в com.example.test1.test1.Test1ApplicationTests contextLoads Истекшее время: 0,002 с <<< ОШИБКА! java .lang.IllegalStateException: не удалось загрузить ApplicationContext, вызванный: java .lang.IllegalStateException: ошибка при обработке условия в org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.jpaVendorAdapter, вызванная: * 10g. .IllegalStateException: не удалось проанализировать класс [org.springframework.boot.autoconfigure.orm.jpa.Hpa. / boot / model / naming / PhysicalNamingStrategy Причина: java .lang.ClassNotFoundException: org.hibernate.boot.model.naming.PhysicalNamingStrategy </p>

Это мой код, поэтому я хочу присоединиться к столбцу OrderTransaction На основе customer_id

это мой orderRepository

    public interface CustomerRepository extends JpaRepository <Customer, Long> {
        @Modifying
        @Query(value ="SELECT ordertransactions.id, Customer.name" +
    "FROM ordertransactions" +
    "INNER JOIN Customer ON orderransactions.id = customer.id;" ,nativeQuery = true)
        int deleteCustomer(Customer Customer); 

    //    @Query(value="select c from customer where c.name=:nama_customer")
    //    Customer findCustomerByName(@Param("namaCustomer")String nama);
        @Query(value="SELECT name, city FROM Customer")
        Customer findCustomerByName(@Param("nameCustomer")String name);
}

это мой customerModel

@Entity
 @Table(name= "Customer")
// @EntityListeners(AuditingEntityListener.class)
public class Customer {

//
    public Customer(Long customer_id, String Name, Integer Phone , String stock , String city) {
        this.customer_id = customer_id;
        this.Name = Name;
        this.Phone = Phone;
        this.stock = stock;
        this.city = city;
    }

    public Long getCustomer_id() {
        return customer_id;
    }

    public void setCustomer_id(Long customer_id) {
        this.customer_id = customer_id;
    }

    public Customer() {
    }

//    public Customer(String string) {
//        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//    }

//    public Customer(Long orderId, Long id, String name, Integer phone, String stock, String city) {
//        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//    }



    public String getName() {
        return Name;
    }

    public void setName(String Name) {
        this.Name = Name;
    }

    public Integer getPhone() {
        return Phone;
    }

    public void setPhone(Integer Phone) {
        this.Phone = Phone;
    }

    public String getStock() {
        return stock;
    }

    public void setStock(String stock) {
        this.stock = stock;
    }


    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }
     @Id
     @GeneratedValue(strategy=GenerationType.IDENTITY)
     private Long customer_id;

     @Column(name="name",nullable=false)
     private String Name;

     @Column(name="phone",nullable=false)
     private Integer Phone;


     @Column(name="stock",nullable=false)
     private String stock;

     @Column(name="city",nullable=false)
     private String city;


}

это мой orderTransaction Model

@Entity
@Table(name= "ordertransactions")
public class OrderTransaction {

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Long id;

    @Column(name="order_name",nullable = false)
    private String OrderName;

    @OneToMany
     @JoinColumn(name = "customer_id", referencedColumnName = "id", updatable = true,nullable = false)
//     @JoinColumn(name = "id", referencedColumnName = "id", updatable = true,nullable = false)
     private Customer customer;


    public OrderTransaction(Long id, String OrderName) {
        this.id = id;
        this.OrderName = OrderName;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getOrderName() {
        return OrderName;
    }

    public void setOrderName(String OrderName) {
        this.OrderName = OrderName;
    }


}

1 Ответ

0 голосов
/ 26 февраля 2020

Кажется, вам не хватает "hibernate-core-5.x.jar" в classpath.

...