Is it bad to use classes, enums etc from other frameworks? I have some finder methods in my repository which is based on JPA, and I want to pass the fetch type (whether it should load the objects lazily or eagerly) and the FetchType enum from JPA framework suit the purpose. But is it better to create your own enum/class? I understand that it makes a coupling between my app and the framework, but my app is already using JPA.
Is it bad to use classes, enums etc from other frameworks? I have some
Share
Indeed, you can use the
FetchTypeenumeration but consider where are you using it. If you have a layered design, avoid using that enum in any layer but the Persistence layer, otherwise you’ll have to import references from JPA in higher layers (if you need to).Another approach (Since you have only
EAGERandLAZY) is to define if a field should be fetched and assign that condition abooleanvalue, like alazyLoadflag.