Skip to content

Commit bb65123

Browse files
author
John Woolbright
committed
persistent-model branch complete
updated gradle version and spring version for compatibility
1 parent fd03bde commit bb65123

4 files changed

Lines changed: 25 additions & 11 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id 'java'
3-
id 'org.springframework.boot' version '3.1.1'
3+
id 'org.springframework.boot' version '3.1.0'
44
id 'io.spring.dependency-management' version '1.1.0'
55
}
66

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.launchcode.codingevents.data;
2+
3+
import org.launchcode.codingevents.models.Event;
4+
import org.springframework.data.repository.CrudRepository;
5+
import org.springframework.stereotype.Repository;
6+
7+
@Repository
8+
public interface EventRepository extends CrudRepository<Event, Integer> {
9+
}

src/main/java/org/launchcode/codingevents/models/Event.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package org.launchcode.codingevents.models;
22

3+
import jakarta.persistence.Entity;
4+
import jakarta.persistence.GeneratedValue;
5+
import jakarta.persistence.Id;
36
import jakarta.validation.constraints.Email;
47
import jakarta.validation.constraints.NotBlank;
58
import jakarta.validation.constraints.Size;
@@ -9,10 +12,12 @@
912
/**
1013
* Created by Chris Bay
1114
*/
15+
@Entity
1216
public class Event {
1317

18+
@Id
19+
@GeneratedValue
1420
private int id;
15-
private static int nextId = 1;
1621

1722
@NotBlank(message = "Name is required")
1823
@Size(min = 3, max = 50, message = "Name must be between 3 and 50 characters")
@@ -28,22 +33,18 @@ public class Event {
2833
private EventType type;
2934

3035
public Event(String name, String description, String contactEmail, EventType type) {
31-
this();
3236
this.name = name;
3337
this.description = description;
3438
this.contactEmail = contactEmail;
3539
this.type = type;
3640
}
3741

38-
public Event() {
39-
this.id = nextId;
40-
nextId++;
41-
}
42+
public Event() {}
43+
4244
public String getName() {
4345
return name;
4446
}
4547

46-
4748
public void setName(String name) {
4849
this.name = name;
4950
}
@@ -64,9 +65,13 @@ public void setContactEmail(String contactEmail) {
6465
this.contactEmail = contactEmail;
6566
}
6667

67-
public EventType getType() { return type; }
68+
public EventType getType() {
69+
return type;
70+
}
6871

69-
public void setType(EventType type) { this.type = type; }
72+
public void setType(EventType type) {
73+
this.type = type;
74+
}
7075

7176
public int getId() {
7277
return id;

0 commit comments

Comments
 (0)