Mel*_*ius 3 java spring hibernate jpa spring-data
我有Settlement实体
@Entity
@Table(name = "settlement")
public class Settlement {
@ManyToOne
@JoinColumn(name = "subscription_x_product_id")
private ProductSubscription productSubscription;
Run Code Online (Sandbox Code Playgroud)
与ProductSubscription实体有关
@Entity
@Table(name = "subscriptionproduct")
public class ProductSubscription {
@ManyToOne
@JoinColumn(name = "product_id")
private Product product;
Run Code Online (Sandbox Code Playgroud)
与Product实体有关
@Entity
public class Product {
@Transient
private String enabled;
Run Code Online (Sandbox Code Playgroud)
在Product实体中我有enabled一个注释的字段@org.springframework.data.annotation.Transient.我也有存储库
public interface SettlementRepository extends JpaRepository<Settlement, Integer>
Run Code Online (Sandbox Code Playgroud)
当我打电话给SettlementRepository.findAll(); 它时给予例外Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name 'enabled'.
如何忽略enabled从DB加载的字段?
我找到了解决方案,问题出现在Annotation中,@org.springframework.data.annotation.Transient一旦我改变@javax.persistence.Transient它就可以了.
| 归档时间: |
|
| 查看次数: |
3365 次 |
| 最近记录: |