Kotlin is a very interesting programming language created by JetBrains that runs on the JVM. One of its features is data classes, which are class...
For further actions, you may consider blocking this person and/or reporting abuse
Hello,
Thanks for your article.
I wrote a code based on what you wrote, and have difficulties to persist an entity in the database.
I added a persistence.xml file at the following path: src/main/resources/META-INF
And the code to persist my entity is:
I added "javax.persistence-api" version 2.2 as dependency in my pom.xml and also enabled the JPA support as described here kotlinlang.org/docs/reference/comp....
I am pretty sure the persistence.xml file is not detected because the error is the same when I delete it.
Could you provide the full working code of your example so I can try to reproduce it ?
Thanks in advance for your help,
Tony
Shouldn't I have to declare @JoinColumn(name = "task_list_id")? I keep getting the following error:
ERRO: column planos0_.convenio_id_convenio does not exist
In my case, Plano is task and Convenio is TaskList.
Hi, Livio! Great post. I'm interested in how to do deletions in onetomany relation. Im looking for help. I have User Role classes, and I want, when I deleting my Role, I want to kill relation link on User(role_id = null, like so on). How can I achieve this?
Short & sweet.
In most cases I find that common entity fields like id, verison, dateCreated, lastUpdated are pulled up in a super base entity class. Could you please explain that scenario too ?
Sorry for the late reply.
I did some tests and found out that inheritance with data classes can be tricky, specially if you have to set fields on the base class, since you cannot have arguments on the primary constructor that are not properties.
If the fields in the base class are auto generated (like Id, creation date), you can do something like this:
For more complex cases, I believe it is better to use normal classes.
I love it every time I get a DEV post as a Google search result in the first 5 or so links!
Thanks for sharing this, Livio :)