Question: I'm trying to develop a library with generic classes to integrate into other projects. For example, a class representing interval:

```java
@Data
public class Interval {
    private Instant start;
    private Instant end;
}

```

Since this library might be used by the projects that do not work with Hibernate / Spring, i would like not to include Hibernate dependency and its annotations.

Is there any way, from the perspective of a project using this library together with Hibernate, to make the class above `Embeddable` without subclassing it and annotating the child class myself ?

Answer: 
Well, for once, annotations are just annotations, so depending projects don't need a dependency on JPA/Hibernate to use the classes. The annotations will simply not be available if the annotation classes are not available.

Apart from that, you could also create an orm.xml file that provides the mapping information. Users of your library would then have to import that file.
For later reference, creating custom types in Hibernate will be a great choice to make external library integratable into Hibernate-managed entities.

<https://www.baeldung.com/hibernate-custom-types>