J'ai essayé le tutoriel officiel. https://github.com/domaframework/doma-spring-boot
application.properties
doma.dialect=h2
pom.xml
<!--h2 ajouté-->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<!--Ajout lié à Doma-->
<dependency>
<groupId>org.seasar.doma.boot</groupId>
<artifactId>doma-spring-boot-starter</artifactId>
<version>1.4.0</version>
<exclusions>
<exclusion>
<groupId>org.seasar.doma</groupId>
<artifactId>doma-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.seasar.doma</groupId>
<artifactId>doma</artifactId>
<version>2.29.0</version>
</dependency>
Entity
import org.seasar.doma.Entity;
import org.seasar.doma.GeneratedValue;
import org.seasar.doma.GenerationType;
import org.seasar.doma.Id;
@Entity
public class Reservation {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Integer id;
public String name;
}
Dao
import java.util.List;
import org.seasar.doma.Dao;
import org.seasar.doma.Insert;
import org.seasar.doma.Select;
import org.seasar.doma.boot.ConfigAutowireable;
import org.springframework.transaction.annotation.Transactional;
@ConfigAutowireable
@Dao
public interface ReservationDao {
@Select
List<Reservation> selectAll();
@Insert
@Transactional
int insert(Reservation reservation);
}
Si une erreur de construction se produit ...
Référence: https://doma.readthedocs.io/en/2.5.0/build/ [Construire avec Eclipse] -Activer le traitement des annotations ・ Réglage du chemin d'usine