小编Pio*_*otr的帖子

这是DDD应用程序还是域服务?

我对整个域驱动设计有点陌生,如果你能告诉我你认为这样的服务方法在应用程序或域层中的位置,我会很高兴:

List<Children> getChildrenByParent(Parent parent, int offset, int count) {

   return repository.listChildrenByParent(Parent parent, int offset, int count);
}
Run Code Online (Sandbox Code Playgroud)

我还想知道当模型中有大量实体和/或我需要有效地过滤事物时,这是否是一种可接受的做事方式.

谢谢

domain-driven-design

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

为什么@AfterReturning只在@AfterThrowing异常后执行?

我有以下内容:

@AfterReturning("executionOfTrustedAnnotatedMethod()")
public void afterReturningFromTrustedMethodExecution() { ... }

@AfterThrowing(pointcut = "executionOfTrustedAnnotatedMethod()")
public void afterThrowingByExecutionOfTrustedAnnotatedMethod() { ... }
Run Code Online (Sandbox Code Playgroud)

我观察到这种对我没有意义的行为:

  • 如果此切入点捕获的方法没有抛出异常,则执行@AfterReturning
  • 如果方法抛出异常,@ AfterReturning仅在@AfterThrowing存在且先执行时执行

我想要完成的是在方法执行结束时运行一些代码,无论是否抛出异常.但现在这个代码运行了两次(如果我同时有afterReturning和afterThrowing)或根本没有(如果我只有afterReturning),如果抛出异常.

有什么建议?

谢谢,彼得

java aop spring aspectj

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

在graphql中实现多个接口

我正在使用中继编译器,它不允许我编译具有实现多个接口的类型的模式.我做了一个小测试项目:

的package.json

{
  "scripts": {
    "relay": "relay-compiler --src ./ --schema schema.graphqls"
  },
  "dependencies": {
    "react-relay": "1.5.0"
  },
  "devDependencies": {
    "relay-compiler": "1.5.0"
  }
}
Run Code Online (Sandbox Code Playgroud)

schema.graphqls

interface First {
    a: String
}

interface Second {
    b: String
}

type Something implements First, Second {
    a: String
    b: String
}
Run Code Online (Sandbox Code Playgroud)

test.js

import { graphql } from "react-relay";

graphql`fragment Test_item on Something {
    a
    b
}`;
Run Code Online (Sandbox Code Playgroud)

如果你用npm run relay运行它(在npm install之后),你会得到错误:

Error: Error loading schema. Expected the schema to be a .graphql or a .json …
Run Code Online (Sandbox Code Playgroud)

relay reactjs graphql relaymodern

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

如何在Spring和JPA / Hibernate中实现工作单元?

我试图了解UOW的概念以及如何在DDD的spring / jpa / hibernate应用程序中实现它。我使我的方法具有事务性,但是如何确保事务中所有已更改的实体都保持不变?是通过使用级联集合还是其他方法?

java spring domain-driven-design hibernate jpa

2
推荐指数
1
解决办法
6946
查看次数

是否可以使用aspectj捕获所有异常?

我想确保每次使用特定注释注释的方法抛出异常时都会执行建议.这可能吗?

java aop aspectj

2
推荐指数
1
解决办法
3225
查看次数

ON DELETE CASCADE 在 SQLite 中不起作用

在适用于 iOS 的 SQLite (3.7.7) 中,我正在运行这些查询:

PRAGMA foreign_keys = ON;

create table venue(id integer primary key not null, name text not null);

create table event(id integer primary key not null, name text not null, 
venue_id integer references venue(id) on delete cascade);
Run Code Online (Sandbox Code Playgroud)

但是当我删除一个场地时,儿童事件不会被删除。有任何想法吗?

sqlite

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

为什么UIScrollView没有弹跳?

我这样做:

    scrollView = [[UIScrollView alloc] initWithFrame:self.bounds];
    [self addSubview:scrollView];

    NSInteger x = scrollView.bounds.origin.x + Padding, y = scrollView.bounds.origin.y + Padding;

    backButton = [[AButtonControl alloc] initWithCaption:@"Back" style:AButtonViewStyleGreen];
    backButton.frame = CGRectMake(x, y, backButton.frame.size.width, backButton.frame.size.height);
    y += backButton.frame.size.height + Spacing;
    [scrollView addSubview:backButton];

    ownerNameTextField = [[AFormTextField alloc] initWithFrame:CGRectMake(x, y, 200, 60) label:@"Guest name"];
    y += ownerNameTextField.frame.size.height + Spacing;
    [scrollView addSubview:ownerNameTextField];

    guestListSelectField = [[AFormSelectField alloc] initWithFrame:CGRectMake(x, y, 200, 60) label:@"Guest list"];
    y += guestListSelectField.frame.size.height + Spacing;
    [scrollView addSubview:guestListSelectField];

    referenceUserSelectField = [[AFormSelectField alloc] initWithFrame:CGRectMake(x, y, 200, 60) …
Run Code Online (Sandbox Code Playgroud)

iphone uiscrollview ios

0
推荐指数
1
解决办法
2404
查看次数