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
package tests; | |
import java.io.Serializable; | |
import java.util.Calendar; | |
import javax.persistence.Column; | |
import javax.persistence.Entity; | |
import javax.persistence.EntityManager; | |
import javax.persistence.EntityManagerFactory; | |
import javax.persistence.GeneratedValue; |
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
/** This breaks several criteria queries, especially root.subquery() and a join on foobar in the subquery */ | |
@Id | |
@ManyToOne(fetch=FetchType.EAGER, optional=false) | |
@JoinColumn(name="foobar_id") | |
@Fetch(FetchMode.JOIN) | |
Foobar foobar; | |
@Id | |
@Column(name="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
Random random = new Random(System.currentTimeMillis()); | |
random.doubles().limit(10).forEach(x -> { | |
// hogehoge | |
}); |
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
public static Map<LocalDate, Integer> summarizePeriodsOld(final List<Bike> bikes, final Predicate<Map.Entry<LocalDate, Integer>> entryFilter) { | |
return bikes.stream() | |
.filter(Bike::hasMilages) | |
.flatMap(bike -> bike.getPeriods().entrySet().stream()) | |
.filter(Optional.ofNullable(entryFilter).orElse(entry -> true)) | |
.collect( | |
HashMap::new, | |
(map, period) -> { | |
map.merge(period.getKey(), period.getValue(), (val1, val2) -> val1 + val2); | |
}, |
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
public static Map<LocalDate, Integer> summarizePeriods(final List<Bike> bikes, final Predicate<Map.Entry<LocalDate, Integer>> entryFilter) { | |
return bikes.stream() | |
.filter(Bike::hasMilages) | |
.flatMap(bike -> bike.getPeriods().entrySet().stream()) | |
.filter(Optional.ofNullable(entryFilter).orElse(entry -> true)) | |
.collect( | |
Collectors.groupingBy( | |
Map.Entry::getKey, | |
Collectors.reducing(0, Map.Entry::getValue, Integer::sum) | |
) |
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
List<String> converted = Files.lines(file, StandardCharsets.UTF_8) | |
.map(line -> line.replace("<credentialsId>oldID</credentialsId>", "<credentialsId>newID</credentialsId>")) | |
.collect(Collectors.toList()); |
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 java.util.Map; | |
import org.jooq.Record; | |
import org.jooq.RecordMapper; | |
import org.jooq.RecordMapperProvider; | |
import org.jooq.RecordType; | |
import org.jooq.impl.DefaultRecordMapper; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.cache.annotation.Cacheable; | |
import org.springframework.core.ResolvableType; |
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
package de.enerko.ensupply.config; | |
import org.jooq.ConnectionProvider; | |
import org.jooq.ExecuteListenerProvider; | |
import org.jooq.SQLDialect; | |
import org.jooq.TransactionProvider; | |
import org.jooq.impl.DefaultConfiguration; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.jooq.RecordMapperProvider; |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.example</groupId> | |
<artifactId>demo</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<packaging>jar</packaging> | |
<name>demo</name> | |
<description>Demo project for Spring Boot</description> |
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
package org.hibernate.bugs; | |
import java.time.LocalDate; | |
import java.time.ZoneId; | |
import java.time.ZonedDateTime; | |
import java.util.List; | |
import javax.persistence.Entity; | |
import javax.persistence.EntityManager; | |
import javax.persistence.EntityManagerFactory; | |
import javax.persistence.GeneratedValue; |