小编Sim*_*ett的帖子

我如何在 Spring Data Hibernate 的关系表中使用 findBy

我附上了我的表数据的快照。表名称是orderdetail

我想获取有关客户的数据。就像我的例子一样,数据应该基于PurchasedBy.

@Entity
public class OrderDetail {

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

    @ManyToOne
    @JoinColumn(name="purchased_By")
    private User purchasedBy;
Run Code Online (Sandbox Code Playgroud)

OrderDetailDao我正在尝试在存储库中使用以下查询

List<OrderDetail> findByPurchasedBy(User user);
Run Code Online (Sandbox Code Playgroud)

但我收到错误:

Caused by: java.lang.IllegalArgumentException: Unable to locate Attribute  with the the given name [purchasedBy] on this ManagedType [com.example.Domain.OrderDetail]
Run Code Online (Sandbox Code Playgroud)

编辑摘要 > 当我使用findAll()并返回 json 时,该purchasedBy部分如下所示:

  "purchasedBy":{  
         "id":15,
         "email":"admin@gmail.com",
         "password":"$2a$10$jj41EbJZTOBfbKdJ6wAdx.rdQq8qU3OqoSzS5mvDVaiL33G1U4pPC",
         "name":"admin",
         "lastName":"admin",
         "active":1,
         "roleselected":null,
         "roles":[  
            {  
               "id":1,
               "role":"admin",
               "users":[  

               ],
               "new":false
            }
         ],
         "new":false
      }
   }
Run Code Online (Sandbox Code Playgroud)

订单明细表图片

java spring hibernate spring-data spring-data-jpa

6
推荐指数
1
解决办法
5798
查看次数

用于braintree.dropin v3 类型的角度类型

我正在将 Braintree Drop-in v3 集成到带有 package 的 angular 应用程序中 npm i -save braintree-web-drop-in

然后我发现@types/braintree-web我正在遵循此处提到的示例的包但它似乎不包含对 Drop-in 功能的支持。显然,这不是正确的包。

braintree.dropin.create({
  authorization: environment.braintreeKey,
  selector: '#dropin-container'
}, function (err, dropinInstance) {
  if (err) {
    // Handle any errors that might've occurred when creating Drop-in
    console.error(err);
    return;
  }
  submitButton.addEventListener('click', function () {
    dropinInstance.requestPaymentMethod(function (err, payload) {
      if (err) {
        // Handle errors in requesting payment method
      }

      // Send payload.nonce to your server
    });
  });
});
Run Code Online (Sandbox Code Playgroud)

我有进口声明 import * …

braintree typescript-typings

3
推荐指数
1
解决办法
1301
查看次数