@Transient in spring data not working
I have Settlement
entity
@Entity
@Table(name = "settlement")
public class Settlement {
@ManyToOne
@JoinColumn(name = "subscription_x_product_id")
private ProductSubscription productSubscription;
ProductSubscription
entity related
@Entity
@Table(name = "subscriptionproduct")
public class ProductSubscription {
@ManyToOne
@JoinColumn(name = "product_id")
private Product product;
Product
entity related
@Entity
public class Product {
@Transient
private String enabled;
in the Product
object i have a field enabled
that is annotated with @org.springframework.data.annotation.Transient
. also i have a repository
public interface SettlementRepository extends JpaRepository<Settlement, Integer>
when i call SettlementRepository.findAll();
it gives an exceptionCaused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name 'enabled'.
How can I ignore the field enabled
from loading from DB?
source to share
I found the solution, the problem was in Annotation @org.springframework.data.annotation.Transient
after I changed to @javax.persistence.Transient
, it worked fine.
source to share