> How about generating a getPK() method which always returns the (value of > the) PK, no matter what the column is called?
You can always introspect your schema meta-data at runtime using methods like this: http://www.jooq.org/javadoc/latest/org/jooq/UpdatableTable.html#getMainKey%28%29 All updatable tables (tables with a primary key or at least one unique key) will return key information, which you can then use to query using primary keys. >> I can see how it might make sense in pojos but then the pojos wouldn't >> be pojos anymore. >> What do you think? Would that really add value to pojos? > > My main worry is that it breaks symmetry. Why can I do something with the > record that I can't do with the POJO despite the fact that the POJO does > have all the information necessary? Likewise: Why doesn't the POJO extend a jOOQ base class, but the Record does? The asymmetry is by design. It should stay that way. Records have features, POJOs don't (apart from annotations, which have made it into POJOs since JPA, for some reason) > Spring Data uses "get". In Java, there is no real distinction between > "return something that exists" and "search for something" -> both use "get" > :-( Yes, I've seen that before. In my opinion, "get" should not execute any operations. Operations should denote themselves using a special verb > I like "fetch". So we agree, then :-)
