I'm getting the following when trying to use JPA, ...
# spring
s
I'm getting the following when trying to use JPA, spring, noargs, all-open.
Copy code
Class 'CmcSbsbSubsc' should have [public, protected] no-arg constructor
this doesn't seem to be a compiler issue though...it compiles fine through maven. Does this mean this intention is wrong because we are doing noarg at annotation time? and i should tell IDEA to ignore that warning on the class name?
Copy code
@Entity
@Table(name = "CMC_SBSB_SUBSC", schema = "FACETCOR")
data class CmcSbsbSubsc(
    @Id
    @Column(name = "SBSB_CK", nullable = false)
    val sbsbCk: Long,

    @Column(name = "SBSB_ID", nullable = false)
    val sbsbId: String
)
m
Include JPA plugin in your build configuration https://spring.io/guides/tutorials/spring-boot-kotlin/
s
@Mikhail yes i have that, maven compiles it fine. but it seems intellij sees it as a problem that i do not have a ctor [INFO] Applied plugin: 'spring' [INFO] Applied plugin: 'jpa' [INFO] Applied plugin: 'all-open' [INFO] Applied plugin: 'lombok'
m
hm Try restarting /
File -> Repair IDE
?
It will compile in any case, but would fail at runtime if your JPA entity is not proper
a
@sreich Don't use
data class
, just plain
class
instead. Seems to work much better
☝️ 1
💯 1
m
I use
data
on my JPA entities and override
hashcode
and
equals
. Works fine.
s
@Mikhail you didn't happen to use querydsl did you? trying to get annotation processing happening, with maven here
got it working 🙂
👍 1
a
This webinar recording might be helpful

https://www.youtube.com/watch?v=a_6V8xwiv04&t=1s

163 Views