Skip to main content

Repository Definition

Basic Structure

repository_test:
EntityName:
methods:
- id: methodName
query: "JPQL or Native SQL"
params:
paramName: paramType
return: ReturnType
nativeQuery: true/false

Repository Examples

repository_test:
Article:
methods:
- id: findByTitleContaining
query: "SELECT a FROM Article a WHERE a.title LIKE :title"
params:
title: string
return: List<Article>

- id: findByBoardAndDateRange
query: "SELECT a FROM Article a WHERE a.board.bid = :boardId AND a.createDate BETWEEN :startDate AND :endDate"
params:
boardId: long
startDate: datetime
endDate: datetime
return: List<Article>

- id: getArticleStatistics
query: "SELECT b.name as boardName, COUNT(*) as articleCount FROM Article a JOIN a.board b GROUP BY b.bid, b.name"
return: List<Map<String, Object>>
nativeQuery: false

Transaction Port Definition

Transaction Port is a DSL for defining communication with external systems. For more details, see Port Reference.

Basic Structure

transaction:
dto:
DTOName:
fields:
fieldName: fieldType -- description

port:
PortName:
meta: type @configuration
methods:
methodName:
params:
paramName: paramType
return: ReturnType

Port Types

  • dbms: Direct database integration
  • http: HTTP API integration

Port Configuration

  • @datasource("name"): Specify datasource
  • @url("baseUrl"): HTTP base URL

Transaction Port Example

transaction:
dto:
BoardInfo:
fields:
boardId: long -- Board ID
name: string -- Board name
articleCount: int -- Article count

CarInfoOutput:
fields:
brand: string -- Brand name
modelId: string -- Model ID
description: string -- Description

port:
BoardService:
meta: dbms @datasource("main")
methods:
getBoardInfo:
params:
boardId: long
return: BoardInfo

getArticleList:
params:
boardId: long
page: int
size: int
return: List<Article>

ExternalApiPort:
meta: http @url("https://api.external.com")
methods:
getUserInfo:
meta: method @HttpEndpoint(url="/users/{userId}", method="GET")
params:
userId: string
return: Map<String, Object>

createUser:
meta: method @HttpEndpoint(url="/users", method="POST")
params:
body: UserRequest @body
return: UserResponse