Skip to content

Commit 7b1d044

Browse files
committed
add more spring 5 code
1 parent ec1f0f3 commit 7b1d044

7 files changed

Lines changed: 1 addition & 24 deletions

File tree

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

SpringFrameworkStarters/SpringFrameworkGradleStarter/src/main/java/com/javatmp/demo/db/SelectForUpdateApplication.java

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -82,30 +82,6 @@ public void run() {
8282

8383
@Transactional(transactionManager = TRANSACTION_MANAGER_REF)
8484
public void run() throws ExecutionException, InterruptedException {
85-
log.info("env is : {}", env);
86-
log.info("ApplicationConfiguration is : {}", applicationConfiguration);
87-
log.info("emf : {}", emf);
88-
89-
EntityManager em = emf.createEntityManager();
90-
log.info("em is : {}", em);
91-
92-
User user = em.find(User.class, new Long(1));
93-
94-
log.debug("user is : {}", user);
95-
96-
User user2 = repository.findByUserName("Petra64").get();
97-
98-
log.debug("user2 : {}", user2);
99-
100-
user2.setLastAccessTime(new Date());
101-
102-
repository.save(user2);
103-
104-
em.close();
105-
106-
log.info("user repository is : {}", repository);
107-
User user3 = this.em.find(User.class, 3L);
108-
log.info("user3 : {}", user3);
10985

11086
// fetch an individual customer by ID
11187
Optional<User> customer1 = repository.findById(1L);
@@ -129,6 +105,7 @@ public void run() throws ExecutionException, InterruptedException {
129105

130106
Stream<User> customerStream = repository.selectForUpdateNative(0);
131107
Optional<User> optionalCustomer = customerStream.findFirst();
108+
log.info("is present : {}", optionalCustomer.isPresent());
132109
optionalCustomer.ifPresent(customer -> {
133110
log.info("customer exists is {}", customer);
134111
// customer.setStatus(1);

0 commit comments

Comments
 (0)