Skip to content

Instantly share code, notes, and snippets.

@rolroralra
Last active July 14, 2022 02:10
Show Gist options
  • Save rolroralra/4d0b53747cdce1d4517fbb93fb28d40b to your computer and use it in GitHub Desktop.
Save rolroralra/4d0b53747cdce1d4517fbb93fb28d40b to your computer and use it in GitHub Desktop.
JPA

@Transactional propagation

https://n1tjrgns.tistory.com/266

https://lion-king.tistory.com/entry/SpringSpring-Boot-Transactional-%EC%98%B5%EC%85%98-propagation-isolation


JPA와 LocalDate, LocalDateTime 사용하기

http://blog.eomdev.com/java/2016/01/04/jpa_with_java8.html


Supported keyword inside method names (Spring Data JPA)

Details

image


spring.jpa.open-in-view meaning

https://stackoverflow.com/questions/30549489/what-is-this-spring-jpa-open-in-view-true-property-in-spring-boot


JPA Auditing (@CreatedDate, @LastModifiedDate)

https://velog.io/@sa1341/JPA-Auditing


persistence.xml

Details

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" version="2.1">

    <persistence-unit name="jpabook">

        <properties>

            <!-- 필수 속성 -->
            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
            <property name="javax.persistence.jdbc.user" value="sa"/>
            <property name="javax.persistence.jdbc.password" value=""/>
            <property name="javax.persistence.jdbc.url" value="jdbc:h2:tcp://localhost/~/Workspace/h2-test/test"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />

            <!-- 옵션 -->
            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.format_sql" value="true" />
            <property name="hibernate.use_sql_comments" value="true" />
            <property name="hibernate.id.new_generator_mappings" value="true" />
            <property name="hibernate.hbm2ddl.auto" value="create" />


            <!-- 기본 매핑 이름 -->
             <property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy" />

        </properties>
    </persistence-unit>

</persistence>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment