Geert Bevin wrote:
Adding support for it with a BeanType restore(long) method is no problem at all, however it's less easy with int update(BeanType bean), int save(BeanType bean) and int getIdentifierValue(BeanType bean) since you can just overload primitive return types. I sadly can't really think of an elegant solution besides creating a GenericQueryManagerLong interface and all the related classes, or using the Number interface instead where int is used. Not sure about the performance of the latter though since objects will have to be created for each and every use of identifier values. Suggestions about how to solve this are very welcome!

I'm not sure if it counts as "elegant," but something like this would at least be functional:

- Add BeanType restore(long) as you suggest. Maybe also BeanType restore(Number). - Add <T extends Number> getIdentifierValue(BeanType bean, Class<T> idType) to return an identifier of any type. (Does it make sense to support String identifiers too?) - Alternately, or perhaps in addition, add getIdentifierValueLong(BeanType bean) to avoid the object creation. - For update and insert, if the identifier type is something other than int, make them return -1. Add a new method <T extends Number> getLastIdentifier(Class<T> idType) and/or getLastIdentifierLong() that returns the identifier from the most recent call.

RifeConfig.Authentication.getTableUser() should give you that.

Super, that works perfectly. I've updated the database user examples in the user's guide cookbook.

I have also updated that page to include an example of reading additional user data, which I realized I didn't do the first time around. I think the database user docs are now at a point where I wouldn't have been frustrated by them. (But I no longer have the perspective of someone who's brand new to the subject; I guess time will tell if the docs are sufficient to get someone new up to speed.)

-Steve
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to