File tree 3 files changed +56
-4
lines changed
spring-data-rest/src/main/java/com/baeldung
3 files changed +56
-4
lines changed Original file line number Diff line number Diff line change @@ -64,22 +64,22 @@ final Properties additionalProperties() {
64
64
65
65
@ Configuration
66
66
@ Profile ("h2" )
67
- @ PropertySource ("persistence-h2.properties" )
67
+ @ PropertySource ("classpath: persistence-h2.properties" )
68
68
class H2Config {}
69
69
70
70
@ Configuration
71
71
@ Profile ("hsqldb" )
72
- @ PropertySource ("persistence-hsqldb.properties" )
72
+ @ PropertySource ("classpath: persistence-hsqldb.properties" )
73
73
class HsqldbConfig {}
74
74
75
75
76
76
@ Configuration
77
77
@ Profile ("derby" )
78
- @ PropertySource ("persistence-derby.properties" )
78
+ @ PropertySource ("classpath: persistence-derby.properties" )
79
79
class DerbyConfig {}
80
80
81
81
82
82
@ Configuration
83
83
@ Profile ("sqlite" )
84
- @ PropertySource ("persistence-sqlite.properties" )
84
+ @ PropertySource ("classpath: persistence-sqlite.properties" )
85
85
class SqliteConfig {}
Original file line number Diff line number Diff line change
1
+ package com .baeldung .models ;
2
+
3
+ import javax .persistence .Column ;
4
+ import javax .persistence .Entity ;
5
+ import javax .persistence .GeneratedValue ;
6
+ import javax .persistence .GenerationType ;
7
+ import javax .persistence .Id ;
8
+
9
+ @ Entity
10
+ public class Subject {
11
+
12
+ @ Id
13
+ @ GeneratedValue (strategy =GenerationType .IDENTITY )
14
+ private long id ;
15
+
16
+ @ Column (nullable = false )
17
+ private String name ;
18
+
19
+ public Subject () {
20
+ }
21
+
22
+ public long getId () {
23
+ return id ;
24
+ }
25
+
26
+ public void setId (long id ) {
27
+ this .id = id ;
28
+ }
29
+
30
+ public String getName () {
31
+ return name ;
32
+ }
33
+
34
+ public void setName (String name ) {
35
+ this .name = name ;
36
+ }
37
+ }
Original file line number Diff line number Diff line change
1
+ package com .baeldung .repositories ;
2
+
3
+ import org .springframework .data .domain .Page ;
4
+ import org .springframework .data .domain .Pageable ;
5
+ import org .springframework .data .repository .PagingAndSortingRepository ;
6
+ import org .springframework .data .repository .query .Param ;
7
+ import org .springframework .data .rest .core .annotation .RestResource ;
8
+ import com .baeldung .models .Subject ;
9
+
10
+ public interface SubjectRepository extends PagingAndSortingRepository <Subject , Long > {
11
+
12
+ @ RestResource (path = "nameContains" )
13
+ public Page <Subject > findByNameContaining (@ Param ("name" ) String name , Pageable p );
14
+
15
+ }
You can’t perform that action at this time.
0 commit comments