liefke / org.fastnate

The Offline SQL Generator
Apache License 2.0
16 stars 11 forks source link

Support annotation GenericGenerator #53

Open mpribela opened 4 years ago

mpribela commented 4 years ago

Hi,

is there any plan of supporting @GenericGenerator annotation?

Thanks for the answer

liefke commented 4 years ago

Which strategy do you have in mind?

We can't support all IdentifierGenerator implementations, because some of them need access to an active database session, which is usually not available in Fastnate.

But we could provide a configuration option, where one can define his own "GeneratorFactory" that knows how to deal with the required strategies. For example the uuid strategy could be easily emulated in such a factory.

I will schedule this for the next version, because it is an easy change.

mpribela commented 4 years ago

Thank you for the fast response.

We are referencing our custom class where we overriding methods from PostInsertIdentifierGenerator, Configurable and ExportableProducer. IdentifierGenerator implementations we are using are IdentityGenerator and SequenceStyleGenerator.

Is this still possible?

liefke commented 4 years ago

You will still have to implement the factory which emulates the behavior of your custom generator for Fastnate. With we can't support all I meant especially custom generators.

What you already can do without waiting for me to implement that feature: Extend GeneratorContext and override getGenerator to return your own implementation of an IdGenerator. You can then initialize the EntityImporter with that context.

mpribela commented 4 years ago

I see. Thank you for your support.