Skip to content

Conversation

Sanne
Copy link
Member

@Sanne Sanne commented Apr 1, 2019

replaces #1767 and fixes #1743

Many thanks to @geoand for giving it a shot. Sorry it wasn't as simple as I initially thought!

@geoand
Copy link
Contributor

geoand commented Apr 2, 2019

No problem at all!

implements MutableIdentifierGeneratorFactory, Serializable, ServiceRegistryAwareService {

private final DefaultIdentifierGeneratorFactory original = new DefaultIdentifierGeneratorFactory();
private final ConcurrentHashMap<String, Class<? extends IdentifierGenerator>> typeCache = new ConcurrentHashMap<>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering if we should clear this cache at some point, considering we keep references to the classes? Or is it taken care of somehow?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No we don't want to clear them as they are used by ORM at runtime:

  • the instance is scoped for the specific SessionFactgory instance
  • It will only contain references to Class instance of the few ID generators actually used (stuff which is going to be on the heap even if we don't refer to it)

@Sanne
Copy link
Member Author

Sanne commented Apr 2, 2019

@gsmet approved? would be good to have this in

@gsmet gsmet merged commit 62f82a5 into quarkusio:master Apr 3, 2019
@gsmet gsmet added this to the 0.13.0 milestone Apr 3, 2019
@Sanne Sanne deleted the IdGenerators branch April 3, 2019 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/persistence OBSOLETE, DO NOT USE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Register Hibernate @GenericGenerator strategy implementations for reflective access

3 participants