-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic integration tests to sample
- Loading branch information
Showing
15 changed files
with
391 additions
and
98 deletions.
There are no files selected for viewing
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
16 changes: 0 additions & 16 deletions
16
...-demo-app/src/main/java/com/oracle/coherence/hibernate/demo/configuration/EventMixin.java
This file was deleted.
Oops, something went wrong.
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
15 changes: 10 additions & 5 deletions
15
...rnate-demo-app/src/main/java/com/oracle/coherence/hibernate/demo/dao/EventRepository.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
/* | ||
* Copyright (c) 2020, Oracle and/or its affiliates. | ||
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. | ||
* | ||
* Licensed under the Universal Permissive License v 1.0 as shown at | ||
* https://oss.oracle.com/licenses/upl. | ||
*/ | ||
package com.oracle.coherence.hibernate.demo.dao; | ||
|
||
import com.oracle.coherence.hibernate.demo.model.Event; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.jpa.repository.QueryHints; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import com.oracle.coherence.hibernate.demo.model.Event; | ||
import javax.persistence.QueryHint; | ||
import java.util.Optional; | ||
|
||
/** | ||
* | ||
* @author Gunnar Hillert | ||
* | ||
*/ | ||
@Repository | ||
public interface EventRepository extends JpaRepository<Event, Long> { | ||
|
||
@Query("SELECT event FROM Event event join fetch event.participants p join fetch p.events where event.id = :eventId") | ||
@QueryHints(@QueryHint(name = org.hibernate.annotations.QueryHints.CACHEABLE, value = "true")) | ||
Optional<Event> getEventWithParticipants(@Param("eventId") Long eventId); | ||
} |
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 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
15 changes: 5 additions & 10 deletions
15
...nate-demo-app/src/main/java/com/oracle/coherence/hibernate/demo/service/EventService.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,34 @@ | ||
/* | ||
* Copyright (c) 2020, Oracle and/or its affiliates. | ||
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. | ||
* | ||
* Licensed under the Universal Permissive License v 1.0 as shown at | ||
* https://oss.oracle.com/licenses/upl. | ||
*/ | ||
package com.oracle.coherence.hibernate.demo.service; | ||
|
||
import java.util.Date; | ||
|
||
import com.oracle.coherence.hibernate.demo.model.Event; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
|
||
import com.oracle.coherence.hibernate.demo.model.Event; | ||
import java.time.LocalDate; | ||
|
||
/** | ||
* | ||
* @author Gunnar Hillert | ||
* | ||
*/ | ||
public interface EventService { | ||
|
||
/** | ||
* | ||
* @return | ||
*/ | ||
Page<Event> listEvents(Pageable pageable); | ||
|
||
/** | ||
* | ||
* @param title | ||
* @param date | ||
* @return | ||
*/ | ||
Long createAndStoreEvent(String title, Date date); | ||
Long createAndStoreEvent(String title, LocalDate date); | ||
|
||
Event getEvent(Long id); | ||
Event getEvent(Long id, boolean withParticipants); | ||
|
||
} |
Oops, something went wrong.