Hibernate/JPA table HT_xxx doesn't exist (inheritance joined)

Viewed 85

I have one issue, with data table. I created four entities, and I used inheritance by joined, but when I want update value from data table i got error that table doesn't exist... I don't know what kind of problem I do wrong. Please help me and I'm waiting for aswers. Thank you guys.

Main entity

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Builder
public class Policy {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long policyNumber;
    private float sumInsured;

and three like that

@Entity
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class LifePolicy extends Policy {

    private String reasons;

I created that query in my repo

@Repository
public interface PolicyRepository extends JpaRepository<Policy, Long> {

    @Query("select p from Policy p where p.dateOfIssue >= ?1")
    List<Policy> getPoliciesTwoWeeksAgo(Date date);

    @Query("select p from Policy p where p.kindOfPolicy = ?1 and p.user.login = ?2")
    List<Policy> findByKindOfPolicyAndUser(String kindOfPolicy, String userLogin);

    @Modifying
    @Query("update Policy p set p.daysToPay = ?2, p.daysToEnd = ?3 where p.policyNumber = ?1")
    int updatePolicy(long policyNumber, int daysToPay, int daysToEnd);

}

only method update cast this error below What is this prefix 'HT_'

java.sql.SQLSyntaxErrorException: Table 'agentassistdatabase.HT_policy' doesn't exist
0 Answers
Related