<@U0NT624JZ> I can see why immutable data-classes ...
# server
@rocketraman I can see why immutable data-classes would be useful for data read from the DB, but that's not a deal-breaker for me:
Copy code
@Table(name = "Companies")
@JsonIgnoreProperties(ignoreUnknown = true)
class Company(

	@Column(unique = true)
	var name: String = ""

) : StandardEntity() {

	fun getCompanyByName(em: EntityManager, name: String): Company {
		val query = em.createQuery("SELECT o FROM Company AS o WHERE o.name=:name", Company::class.java)
		query.setParameter("name", name)
		return query.singleResult
Copy code
open class StandardEntity {

	@GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
	@Column(name = "id")
	var id: Int? = null

	@Column(name = "version")
	private var version: Int = 0
If hibernate is used properly, queries are also optimal in the majority of cases, if you need something that is much better optimised, there's always the option of native queries. I've used JOOQ and SpringData, Torque, and several other ORMs, Hibernate suits my needs much better. JOOQ actually charges you a license fee if using SQLServer / Oracle DBs, some clients actually use those, so with Hibernate, write in MySQL and just switch to their DBs.