Scrivio Interview library
DebuggingIntermediate7 min read · updated 12 November 2026

After moving to Boot 3, entities compile but Hibernate ignores them and a filter class is never invoked. The project depends on an old internal library. What do you check?

I would check whether the old internal library still uses javax.persistence and javax.servlet types. Boot 3 and Hibernate 6 only recognise jakarta annotations and interfaces, so javax entities are simply not mapped and a javax Filter bean is never registered, even though everything compiles. I would confirm it with mvn dependency:tree, then upgrade the library to a Jakarta version or migrate its code.

Why this question is asked

This is one of the most confusing failures after a Boot 3 upgrade, because there is no compile error and often no clear exception. The code looks right, the annotations are there, and yet the behaviour is gone. Interviewers ask it to see whether we understand that frameworks find our classes by looking for specific types, and that a type with the same simple name in a different package is a completely different type to the JVM. In this answer, we will recap how Boot finds entities and filters, reproduce the problem, trace it with the dependency tree, and then fix it, with a build rule that stops it from coming back.

1A Quick Recap of How Boot Finds Entities and Filters

Hibernate finds entities by scanning packages for classes annotated with @Entity. But an annotation is identified by its fully qualified name. Hibernate 6, which Boot 3 uses, looks for jakarta.persistence.Entity. A class annotated with javax.persistence.Entity carries an annotation Hibernate 6 does not know, so the scan passes over it as if it were a plain class.

Filters work the same way. Spring Boot registers every bean that implements jakarta.servlet.Filter with the embedded servlet container. A class that implements javax.servlet.Filter is still a valid Spring bean if it has @Component, but it does not implement the interface Boot is looking for. It sits in the context doing nothing, and the container never calls it.

So the old and new names are not two spellings of the same thing. To the JVM they are unrelated types that happen to have the same simple names.

2Reproducing the Problem

Suppose the internal library com.acme:acme-common:2.4 contains a base entity and an audit filter written for Boot 2.

Java
// Inside acme-common 2.4, compiled against Java EE
@javax.persistence.Entity
public class AuditRecord { @javax.persistence.Id Long id; String action; }
@Component
public class AuditFilter implements javax.servlet.Filter { /* ... */ }
// In our Boot 3 service
auditRepository.save(new AuditRecord());
// IllegalArgumentException: Not a managed type: class com.acme.common.AuditRecord
// (or the table is never created, if nothing uses the entity through a repository)
// HTTP request to /orders
// AuditFilter.doFilter is never called, and no error is logged

Notice why it compiles. The library jar brings the old javax.persistence-api and javax.servlet-api jars with it as transitive dependencies, so the javax types exist on the classpath. Our own code compiles against the jakarta types from Boot. Both sets sit side by side, and nothing fails until we notice that the behaviour is missing. That is the most important point of the whole problem: mixing javax and jakarta does not fail at compile time, it silently breaks behaviour.

3Tracing It With the Dependency Tree

The quickest way to prove the cause is to ask the build tool which artifacts bring javax EE APIs into the application. In Maven, dependency:tree with an includes filter shows only the matching artifacts and the path that brought each one in.

Shell
mvn dependency:tree -Dincludes=javax.persistence,javax.servlet
[INFO] com.acme:orders-service:jar:1.0.0
[INFO] \- com.acme:acme-common:jar:2.4:compile
[INFO] +- javax.persistence:javax.persistence-api:jar:2.2:compile
[INFO] \- javax.servlet:javax.servlet-api:jar:4.0.1:compile
# Gradle equivalent
./gradlew dependencyInsight --dependency javax.persistence-api
Step throughDebugging missing entities and filters after Boot 3
  1. Symptom: entity not managed or filter never runsno compile error
  2. Check the class's importsjavax.persistence or javax.servlet?
  3. Does the class come from a dependency?
    YesRun mvn dependency:tree -Dincludes=...NoMigrate the imports in our own code
  4. Does a Jakarta version of the library exist?
    YesUpgrade the libraryNoMigrate its code or transform the jar
  5. Ban javax EE artifacts in the buildMaven Enforcer or Gradle constraints

5 steps in order. Play them, or step through them one at a time.

So the tree confirms that acme-common pulls in Java EE APIs. There is a trap here worth knowing: some older artifacts already had a jakarta group id but still contained javax packages. For example, jakarta.persistence:jakarta.persistence-api version 2.2.x and jakarta.servlet:jakarta.servlet-api version 4.0.x still use the javax package names; the package rename came with Persistence 3.0 and Servlet 5.0. So we should also search for those versions, not just for the javax group ids.

To check the library's own classes, we can list the annotations they use with javap, or simply open the jar's sources. A quick look at the imports in AuditRecord and AuditFilter is usually enough.

4Fixing It

The proper fix is to upgrade the library to a version built for Jakarta EE. For an internal library, that means its owners release, say, acme-common 3.0 compiled against Boot 3, using the same OpenRewrite migration recipe we used on the service. Once the service uses the new version, the javax jars disappear from the tree, Hibernate maps AuditRecord, and Boot registers AuditFilter.

XML
<!-- after: acme-common 3.0 uses jakarta.* -->
<dependency>
<groupId>com.acme</groupId>
<artifactId>acme-common</artifactId>
<version>3.0.0</version>
</dependency>
// startup log now shows the filter and the entity
// Filter 'auditFilter' configured for use
// select ... from audit_record ... (entity is managed)

If the owners are gone and nobody can release the library, we have two fallbacks. We can copy the few classes we need into our service and migrate them, which is often the best option for small helpers. Or we can run the Eclipse Transformer on the jar to rewrite its bytecode to the jakarta names, which works but leaves us depending on a transformed artifact that nobody maintains, so it should be temporary.

5Stopping It From Coming Back

Because the failure is silent, we want the build to catch it. The Maven Enforcer plugin's bannedDependencies rule can refuse javax.persistence, javax.servlet, javax.validation and the old jakarta artifacts that still contain javax packages. The build then fails with the name of the offending dependency as soon as someone adds one.

A startup test helps too: a Spring Boot test that asserts the expected filters are registered and that the metamodel contains the expected entities turns a silent behaviour change into a failing test.

XML
<rules>
<bannedDependencies>
<excludes>
<exclude>javax.persistence:*</exclude>
<exclude>javax.servlet:*</exclude>
<exclude>javax.validation:*</exclude>
<exclude>jakarta.persistence:jakarta.persistence-api:[,3.0)</exclude>
<exclude>jakarta.servlet:jakarta.servlet-api:[,5.0)</exclude>
</excludes>
</bannedDependencies>
</rules>
<!-- build fails: Found Banned Dependency: javax.servlet:javax.servlet-api:jar:4.0.1 -->

6Follow-up questions

Why does Spring not warn us about a javax Filter bean?

From Spring's point of view there is nothing wrong. The bean is a valid object; it just does not implement jakarta.servlet.Filter, so Boot's servlet registration code never considers it. Spring cannot know that we meant it to be a filter.

Can a Boot 3 application use any javax library at all?

Yes, as long as the javax types are not Jakarta EE APIs that the framework must recognise. JDK packages such as javax.sql and javax.crypto are fine. The problem is only with Java EE specification types, such as persistence annotations, servlet interfaces and validation constraints, where Boot 3 expects the jakarta versions.

How would you find every affected library in a large codebase?

Run the dependency tree with the includes filter across all services in CI and collect the results, and add the enforcer rule to the parent POM. The libraries that appear most often are the ones to migrate first, because each one blocks many services.

7Conclusion

In this answer, we saw that entities and filters can vanish after a Boot 3 upgrade when an old library still uses javax.persistence or javax.servlet. Boot 3 and Hibernate 6 only recognise the jakarta types, and because the old API jars come in as transitive dependencies, everything compiles and the behaviour breaks silently. We found the cause with mvn dependency:tree, fixed it by upgrading or migrating the library, and kept it from returning with an enforcer rule and a startup test.

What to say in the interviewAbout 80 seconds aloud

Open with

Because everything compiles but the entities and the filter are ignored, my first suspicion is a javax and jakarta mix. Boot 3 uses Hibernate 6 and Servlet 6, which only recognise jakarta.persistence.Entity and jakarta.servlet.Filter.

Then, if they want more

If the old internal library still has javax annotations and implements javax.servlet.Filter, Hibernate's scan does not see those classes as entities, and Boot never registers the filter, because the bean does not implement the jakarta interface. It compiles because the library pulls in the old javax API jars transitively, so both sets of types are on the classpath.

To confirm, I check the imports in those classes and run mvn dependency:tree with includes for javax.persistence and javax.servlet, which shows the path through the library. I also look for old jakarta-named artifacts such as persistence-api 2.2, which still contain javax packages.

The fix is a Jakarta release of the library, migrated with the OpenRewrite recipe; if nobody maintains it, I move the few classes into the service or transform the jar temporarily. Then I add a Maven Enforcer rule banning javax EE artifacts, and a startup test for filters and entities, because this failure is otherwise silent.

About this answer

Last updated
12 November 2026
Versions it names
Hibernate 6
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Spring Boot reference
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "After moving to Boot 3, entities compile but Hibernate ignores them and a filter class...": https://scrivio-interview-library.netlify.app/spring-boot/boot-migrations/053b792928/