Hi! I'm very new to Spring Boot, and I made this d...
# spring
t
Hi! I'm very new to Spring Boot, and I made this data class to hold the properties of my SQL item:
Copy code
@Entity
@Table
class Student(
	@Id
	@SequenceGenerator(name = "student_sequence", sequenceName = "student_sequence", allocationSize = 1)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "student_sequence")
	val id: Long,
	val name: String,
	val email: String,
	val dateOfBirth: LocalDate,
	val age: Int = LocalDate.now().year - dateOfBirth.year
)
I'm trying to access it in this class, and I think I'm supposed to leave out the
id
so it can get filled in automatically, but it's not working. Here is where I try to create it:
Copy code
@Configuration
class StudentConfig {
	@Bean
	fun commandLineRunner(repository: StudentRepository): CommandLineRunner {
		return CommandLineRunner{
			val theonlytails = Student(
				"TheOnlyTails",
				"<mailto:shacharzidon@gmail.com|shacharzidon@gmail.com>",
				LocalDate.of(2000, Month.JANUARY, 1)
			)

			repository.save(theonlytails)
		}
	}
}
What is going on here?