This file contains hidden or 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
| MONGO_PORT= | |
| MONGO_DB= | |
| MONGO_USERNAME= | |
| MONGO_PASSWORD= | |
| MONGO_INITDB_ROOT_USERNAME= | |
| MONGO_INITDB_ROOT_PASSWORD= | |
| MONGO_INITDB_DATABASE= | |
| LOG_LEVEL=DEBUG |
This file contains hidden or 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
| version: '3.8' | |
| services: | |
| mongodb: | |
| image: mongo | |
| container_name: ${MONGO_CONTAINER_NAME} | |
| command: mongod --port ${MONGO_PORT} | |
| volumes: | |
| - mongodb_data:/data/db | |
| - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js |
This file contains hidden or 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
| docker run -d --name <name> -v <volume_path>:/var/lib/postgresql/data -e POSTGRES_PASSWORD=<password> -e POSTGRES_USER=<username> -e POSTGRES_DB=<database_name> postgres:<tag>-alpine |
This file contains hidden or 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 = "users") | |
| public class User extends BaseEntity { | |
| } | |
| @Entity | |
| public class Post extends BaseEntity { | |
| @NotBlank |
This file contains hidden or 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
| --> By author id: | |
| Hibernate: | |
| select | |
| post0_.id as id1_0_, | |
| post0_.author_id as author_i3_0_, | |
| post0_.message as message2_0_ | |
| from | |
| post post0_ | |
| left outer join | |
| users user1_ |
This file contains hidden or 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
| startTime = System.nanoTime(); | |
| method(); | |
| endTime = System.nanoTime(); | |
| duration = (endTime - startTime); | |
| results.add(duration); | |
| average = results.stream().mapToLong(Long::longValue).average().getAsDouble() |
This file contains hidden or 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
| @Repository | |
| public interface PostRepository extends CrudRepository<Post, Long> { | |
| Optional<Post> findTopByAuthorOrderByIdDesc(User author); | |
| Optional<Post> findTopByAuthorIdOrderByIdDesc(Long authorId); | |
| @Query("from Post where author_id = ?1 order by id desc") | |
| Optional<Post> findWithCustomQueryOrderByIdDesc(Long authorId); |
This file contains hidden or 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
| @Rule | |
| public TemporaryFolder testFolder = new TemporaryFolder(); | |
| private String filePath; | |
| private final String FILENAME = "testCsvFile.csv"; | |
| @Test | |
| public void generate___shouldSucceed() throws IOException { |
This file contains hidden or 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.Collection; | |
| import javax.persistence.ManyToMany; | |
| import javax.persistence.MappedSuperclass; | |
| import javax.persistence.OneToMany; | |
| import weapon.rental.BaseEntity; | |
| import weapon.rental.hero.domain.Hero; | |
| import weapon.rental.invitation.Invitation; |
This file contains hidden or 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 krzysztof.javaee8.config; | |
| import javax.ws.rs.ApplicationPath; | |
| import javax.ws.rs.core.Application; | |
| @ApplicationPath("/api") | |
| public class JaxRsActivator extends Application{ | |
| } |
NewerOlder