dharrigan
09/06/2017, 4:04 PMkagomez
09/06/2017, 4:04 PMdh44t
09/07/2017, 8:33 AMdh44t
09/07/2017, 8:34 AMsdeleuze
09/07/2017, 9:31 PMsdeleuze
09/07/2017, 9:31 PMsdeleuze
09/07/2017, 9:35 PMdharrigan
09/08/2017, 8:43 AMdharrigan
09/08/2017, 8:44 AM@RequestParam("blah")
stuffdharrigan
09/08/2017, 8:44 AMdharrigan
09/08/2017, 8:44 AMorangy
dharrigan
09/08/2017, 1:33 PMdharrigan
09/08/2017, 1:34 PMtjb
09/11/2017, 3:12 AMNot a managed type
for my entity class, has anyone encountered this? Does it matter that my entity class is a data class
?noone
09/11/2017, 3:15 AM[ {
"title" : "Get Started with PostgreSQL",
"body" : "Use foreign keys to ensure data integrity in Postgres.",
"authorId" : 3,
"createdAt" : 1505016000000,
"id" : 1
} ]
I want the authorId
to return the actual name of the author/user. How can I do that?
PostRepository.kt
@Repository
interface PostRepository : CrudRepository<Post, Long>{
@Query("select posts.*, users.name from posts left join users on users.id = posts.author_id;", nativeQuery = true)
fun getAllPosts (): String
}
PostController.kt
@RequestMapping("/getallposts")
fun getAllPosts () : String {
val posts = repository.getAllPosts()
return posts
}
Post.kt
@Entity(name = "posts")
data class Post (
val title: String,
val body: String,
val authorId: Int,
val createdAt: Date = Date(),
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
val pId: Long = -1) {
private constructor() : this("", "", -1, Date())
}
i get this error.
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.IncorrectResultSizeDataAccessException: query did not return a unique result: 4; nested exception is javax.persistence.NonUniqueResultException: query did not return a unique result: 4] with root cause
xantier
09/11/2017, 9:12 AMfun getAllPosts (): String
--> fun getAllPosts (): List<String>
xantier
09/11/2017, 9:13 AMselect users.name
sdeleuze
09/12/2017, 7:50 AMCzar
09/12/2017, 8:25 AMsdeleuze
09/12/2017, 1:28 PMdh44t
09/12/2017, 1:58 PMsdeleuze
09/12/2017, 2:09 PM@author
tags in the Javadoc commit history show it 🙂varpa89
09/14/2017, 11:34 AMvarpa89
09/14/2017, 11:34 AMvarpa89
09/14/2017, 11:35 AMorg.springframework.web.reactive.function.UnsupportedMediaTypeException: Content type 'application/x-protobuf' not supported
at org.springframework.web.reactive.function.BodyInserters.lambda$null$13(BodyInserters.java:261) ~[spring-webflux-5.0.0.RC4.jar:5.0.0.RC4]
dharrigan
09/14/2017, 12:04 PMsdeleuze
09/14/2017, 12:10 PMvarpa89
09/14/2017, 12:37 PMdharrigan
09/14/2017, 12:37 PM