This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Takipi | |
FROM alpine:3.2 | |
MAINTAINER Chen Harel "https://github.com/chook" | |
# Install dependencies | |
RUN apk --update add curl ca-certificates tar sqlite icu bash && \ | |
curl -Ls https://circle-artifacts.com/gh/andyshinn/alpine-pkg-glibc/6/artifacts/0/home/ubuntu/alpine-pkg-glibc/packages/x86_64/glibc-2.21-r2.apk > /tmp/glibc-2.21-r2.apk && \ | |
apk add --allow-untrusted /tmp/glibc-2.21-r2.apk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RUN apk --update add curl ca-certificates tar && \ | |
curl -Ls https://circle-artifacts.com/gh/andyshinn/alpine-pkg-glibc/6/artifacts/0/home/ubuntu/alpine-pkg-glibc/packages/x86_64/glibc-2.21-r2.apk > /tmp/glibc-2.21-r2.apk && \ | |
apk add --allow-untrusted /tmp/glibc-2.21-r2.apk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.util.{Success, Failure} | |
val f: Future[List[String]] = Future { | |
session.getRecentPosts | |
} | |
f onComplete { | |
case Success(posts) => for (post <- posts) println(post) | |
case Failure(t) => println("An error has occured: " + t.getMessage) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EntityManager em = emf.createEntityManager(); | |
em.getTransaction().begin(); | |
Author a = em.find(Author.class, 1L); | |
em.getTransaction().commit(); | |
em.close(); | |
log.info(a.getFirstName() + " " + a.getLastName() + " wrote "+a.getBooks().size() + " books."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@NamedEntityGraph(name = "graph.AuthorBooks", attributeNodes = @NamedAttributeNode("books")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EntityManager em = emf.createEntityManager(); | |
em.getTransaction().begin(); | |
EntityGraph<?> graph = em.getEntityGraph("graph.AuthorBooks"); | |
HashMap<String, Object> properties = new HashMap<>(); | |
properties.put("javax.persistence.fetchgraph", graph); | |
Author a = em.find(Author.class, 1L, properties); | |
em.getTransaction().commit(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// EntityManager and transaction 1 | |
EntityManager em = emf.createEntityManager(); | |
em.getTransaction().begin(); | |
// EntityManager and transaction 2 | |
EntityManager em2 = emf.createEntityManager(); | |
em2.getTransaction().begin(); | |
// update 1 | |
Author a = em.find(Author.class, 1L); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Id | |
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "authorSequence") | |
@Column(name = "id", updatable = false, nullable = false) | |
private Long id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Id | |
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "authorSequence") | |
@SequenceGenerator(name = "authorSequence", sequenceName = "author_seq", initialValue = 1000) | |
@Column(name = "id", updatable = false, nullable = false) | |
private Long id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
@Table(name = "author", schema = "bookstore") | |
public class Author implements Serializable { | |
… | |
} |
OlderNewer