Hi Ratish, Thank you very much for raising this issue/discussion. I wonder: In JDBC it's only possible to get the auto-incremented value for a single column. That was also the inspiration for the way the metamodel API was designed I think. So that leads me to think - is it even meaningful for this generated key to be on anything else than the primary key column? MetaModel does have a way to get the primary key column. So although there's a bit of an assumptions going on from my side here, but doesn't that also fit your use case, that you could just use the primary key column of the table?
Best regards, Kasper Den ons. 2. jan. 2019 kl. 05.35 skrev RATISH BANSAL <[email protected]>: > Hello, > > *Use case:* I was using Apache Meta Model 5.2.0 in my project.There is > MySQL source with Table Customer. Customer table has column Id which is > primary key and marked auto increment. > The use case is to get the generated *Id *in return when we insert the > record so that user can again query using same returned *Id *to get the > record back if required. > > The returning of generated keys has been fixed sometime back by introducing > Update Summary, but update summary does not tell us what is the column name > of that generated value being returned.i.e it just return the value being > generated. > > Possible solution could be if somehow we know before hand from column > metadata what column is marked auto increment/ auto generated.This way we > can expect the same in return. > > *Problem: *Current meta model implementation doesn't capture this auto > increment property like others i.e name,data types etc; even though the > underlying driver is returning the information. > > *Technical's:* While debugging through the code for MySQL source ,observed > that in loadColumns method in JdbcMetadataLoader class we obtain the > ResultSet from the driver implementation class.This ResultSet has the > required information at index 23 i.e rs.getString(23) but we only capture > certain important information like name, datatype etc and create JdbcColumn > from those. > The solution can be, introducing another variable to capture this property > as well just like others. > Tried the same with PostgreSQL and behavior is similar. The value can be > null if this information is supported by any source. > > It would be great if you could share your thoughts on this.Are there any > plans for such changes in future. > > Thanks & Regards > Ratish Bansal >
