Hello, Can you post more code? E.g. a sample T class (entity). As well as the code that is used to produce this problem?
Cheers Lukas 2012/9/11 Rick van Biljouw <[email protected]>: > Hi, > > I'm trying to create a record using POJOs. > For that purpose I have the following piece of code: >>> >>> /** >>> >>> * Creates a record from a POJO. >>> >>> * >>> >>> * @param pojo >>> >>> * POJO to use for record. >>> >>> * @return record >>> >>> */ >>> >>> @SuppressWarnings({ "unchecked" }) >>> >>> private <R extends Record> R newRecord(T entity) { >>> >>> R record = (R) getFactory().newRecord(getTable(), entity); >>> >>> return record; >>> >>> } > > > The POJOs I have are generated by codegen, sadly enough using this code > together with one of the POJOs results in the following exception being > thrown: >>> >>> Caused by: org.jooq.exception.DataTypeException: Cannot convert from 0201 >>> (class java.lang.String) to class nl.abbabab.tables.records.EmployeeRecord >>> >>> at org.jooq.tools.Convert$ConvertAll.fail(Convert.java:610) >>> ~[jooq-2.5.0-SNAPSHOT.jar:na] >>> >>> at org.jooq.tools.Convert$ConvertAll.from(Convert.java:564) >>> ~[jooq-2.5.0-SNAPSHOT.jar:na] >>> >>> at org.jooq.tools.Convert.convert0(Convert.java:208) >>> ~[jooq-2.5.0-SNAPSHOT.jar:na] >>> >>> at org.jooq.tools.Convert.convert(Convert.java:200) >>> ~[jooq-2.5.0-SNAPSHOT.jar:na] >>> >>> at org.jooq.tools.Convert.convert(Convert.java:259) >>> ~[jooq-2.5.0-SNAPSHOT.jar:na] >>> >>> at org.jooq.impl.AbstractRecord.getValue(AbstractRecord.java:569) >>> ~[jooq-2.5.0-SNAPSHOT.jar:na] > > > I'm really at a loss here as to what is causing it.. > If anyone could tell me where to look to resolve this problem I would > appreciate it.
