Another question. Does `RepositoryRestResource` no...
# spring
a
Another question. Does
RepositoryRestResource
not work with
UUID
? I am getting "EntityRepresentationModel not found!": I have a very simple Entity and Repository:
Copy code
@Entity()
class Account(
    @Id var id: UUID,
    var name: String
)

@RepositoryRestResource(path="accounts", collectionResourceRel = "accounts")
interface AccountRepository : CrudRepository<Account, UUID> {
}

@Bean
fun initializeDatabase(accountRepository: AccountRepository) = ApplicationRunner {
    accountRepository.save(Account(id = UUID.randomUUID(), name = "Test"))
    <http://logger.info|logger.info>("Initialized test data")
}
And when I run the application I get a nice HATEOS response:
Copy code
{
  "_embedded": {
    "accounts": [
      {
        "name": "Test",
        "_links": {
          "self": {
            "href": "<http://localhost:8080/accounts/4c12f420-6189-4abd-a970-573ba2e0ca23>"
          },
          "account": {
            "href": "<http://localhost:8080/accounts/4c12f420-6189-4abd-a970-573ba2e0ca23>"
          }
        }
      }
    ]
  },
  "_links": {
    "self": {
      "href": "<http://localhost:8080/accounts>"
    },
    "profile": {
      "href": "<http://localhost:8080/profile/accounts>"
    }
  }
}
But when I go to that URL I get a 404 and an error in the console saying:
Resolved [org.springframework.data.rest.webmvc.ResourceNotFoundException: EntityRepresentationModel not found!]
It works with a Long as ID. So that is confusing. EDIT: I need to add
@Column(columnDefinition = "BINARY(16)")
to the entity ID.
329 Views