Maybe i had to start saying that not all apps are web apps, there are a lot of client-server apps, like swing for example.
Maybe you can give an example for that? I really don’t know what it is that you are doing or looking for. The description you are giving is very vague.
I have a common.jar which define the object com.example.dto.TransferDto, in ther server.jar file i have the entity com.example.entity.Transfer. The dto is a representation of the entity but with pure native data types, so the Transfer entity is not known by the client.jar. Then in the server.jar there are a package with some hibernate mapping files, that maps a query to a pojo (the DTO). So in the server i can create a criteria with TransferDto object, and hibernate will build a query and has a subquery in it (the subquery will be the query i defined in the hibernate mapping file [Transfer.dto.hbm.xml]). And that’s it, i have not to worry to convert a Entity to a Pojo to send it to the the client, hibernate does the job for me. This situation is not supported by JPA Criteria because it only works with entities.
The annotations are just that, annotations. You don’t need JPA or Hibernate on your classpath if you want to work with such classes. Every JVM will just ignore annotations for which there are no class files available at runtime.
Maybe not, but the common.jar in the development process would need the dependencies, in this case de definition of the entities in aother jar/project, which is something i am not agree with, because the common is that, a common for both sides and it has not to know anything of any side.
Again, i am not saying that JPA Criteria must dissapear, it has its advanges/disadvantages, the only thing i am requesting is that dont quit nice functionality of hibernate, or complement the JPA, spec’s are always that can change for the better. This situation is a real case and i am pretty sure not only for me. Many times i have to write database views, and query them as they were an object thanks to the mapping file and criteria api. If hibernate removes that posibility, our path to solve our needs will be much longer and maybe hard to maintaing. Strong typing not always is the best in all cases.
Thanks