feat(like-expressions): add Song + SongRepository with integration tests (#6633)
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
package com.baeldung.entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
public class Song {
|
||||
|
||||
@Id private long id;
|
||||
private String name;
|
||||
@Column(name = "length_in_seconds")
|
||||
private int lengthInSeconds;
|
||||
private String compositor;
|
||||
private String singer;
|
||||
private LocalDateTime released;
|
||||
private String genre;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getLengthInSeconds() {
|
||||
return lengthInSeconds;
|
||||
}
|
||||
|
||||
public void setLengthInSeconds(int lengthInSeconds) {
|
||||
this.lengthInSeconds = lengthInSeconds;
|
||||
}
|
||||
|
||||
public String getCompositor() {
|
||||
return compositor;
|
||||
}
|
||||
|
||||
public void setCompositor(String compositor) {
|
||||
this.compositor = compositor;
|
||||
}
|
||||
|
||||
public String getSinger() {
|
||||
return singer;
|
||||
}
|
||||
|
||||
public void setSinger(String singer) {
|
||||
this.singer = singer;
|
||||
}
|
||||
|
||||
public LocalDateTime getReleased() {
|
||||
return released;
|
||||
}
|
||||
|
||||
public void setReleased(LocalDateTime released) {
|
||||
this.released = released;
|
||||
}
|
||||
|
||||
public String getGenre() {
|
||||
return genre;
|
||||
}
|
||||
|
||||
public void setGenre(String genre) {
|
||||
this.genre = genre;
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.baeldung.repository;
|
||||
|
||||
import com.baeldung.entity.Song;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface SongRepository extends JpaRepository<Song, Long> {
|
||||
|
||||
List<Song> findByNameLike(String name);
|
||||
|
||||
List<Song> findByNameNotLike(String name);
|
||||
|
||||
List<Song> findByNameStartingWith(String startingWith);
|
||||
|
||||
List<Song> findByNameEndingWith(String endingWith);
|
||||
|
||||
List<Song> findBySingerContaining(String singer);
|
||||
}
|
||||
Reference in New Issue
Block a user