Generated ID always zero

The stack is the following: Spring MVC with Hibernate 4.2.1
Saving entities in Oracle database works correctly: after save() I get the new identifier given by the DB sequence; when I switch to MS Sql Server instance, the save() returns always 0.
Here is the ID field definition:

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "seq")
    @SequenceGenerator(name="seq", sequenceName="SEQ_PEZZI") 
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;

In debug mode, I’ve noticed that the problem is in the following line of code (in AbstractSaveEventListener.java, line 117 saveWithGeneratedId() method):

Serializable generatedId = persister.getIdentifierGenerator().generate( source, entity );

the getIdentifierGenerator() returns POST_INSERT_INDICATOR (while with Oracle, it returns the class name of the entity to save)

Is there some configuration missing, or is it a bug of the Hibernate version?
Thanks for your help

Hard to tell what is going on. You are using a very old version of Hibernate. Just know that sequences are only supported as of SQL Server 2012. If the same issue happens on Hibernate 5.6, we can take a look but for that, I would need a test case(hibernate-test-case-templates/JPAUnitTestCase.java at main · hibernate/hibernate-test-case-templates · GitHub) that reproduces the issue.

Just to add further informations, in SQL Server there is a trigger INSTEAD OF INSERT that sets the ID from a sequence with this snippet:

IF (@NEW$ID < 0 OR @NEW$ID IS NULL)
BEGIN
     SELECT @NV = NEXT VALUE FOR dbo.SEQ_PEZZI
     SET @NEW$ID = @NV
 END

the SQL Server instance version that I am using is the 15.
I will try to move to 5.6 Hibernate version when possible, but it is a real strange behaviour that I suppose it could depend more from SQL Server table configuration than from Hibernate…