@Transient问题

vbagcl vbagcl 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
为什么不能在数据库表jpa反向工程的类中增加@Transient,增加之后会报错,代码如下:
package entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
* Student entity.
*
* @author MyEclipse Persistence Tools
*/
@Entity
@Table(name = "STUDENT", schema = "YKMES", uniqueConstraints = {})
public class Student implements java.io.Serializable {

// Fields

private Long id;
private String stuNo;
private String stuName;
private String homePhone;
private String familyAddr;

// Constructors

/** default constructor */
public Student() {
}

/** minimal constructor */
public Student(Long id) {
this.id = id;
}

/** full constructor */
public Student(Long id, String stuNo, String stuName, String homePhone,
String familyAddr) {
this.id = id;
this.stuNo = stuNo;
this.stuName = stuName;
this.homePhone = homePhone;
this.familyAddr = familyAddr;
}

// Property accessors
@Id
@Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true, precision = 22, scale = 0)
public Long getId() {
return this.id;
}

public void setId(Long id) {
this.id = id;
}

@Column(name = "STU_NO", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
public String getStuNo() {
return this.stuNo;
}

public void setStuNo(String stuNo) {
this.stuNo = stuNo;
}

@Column(name = "STU_NAME", unique = false, nullable = true, insertable = true, updatable = true, length = 20)
public String getStuName() {
return this.stuName;
}

public void setStuName(String stuName) {
this.stuName = stuName;
}

@Column(name = "HOME_PHONE", unique = false, nullable = true, insertable = true, updatable = true, length = 11)
public String getHomePhone() {
return this.homePhone;
}

public void setHomePhone(String homePhone) {
this.homePhone = homePhone;
}

@Column(name = "FAMILY_ADDR", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
public String getFamilyAddr() {
return this.familyAddr;
}

public void setFamilyAddr(String familyAddr) {
this.familyAddr = familyAddr;
}

@Transient
private String x;

}


@Entity报:entity does not have a id
其他字段报:the column xxxxx can not be found on table STUDENT.

为啥啊,请高手指点!!!!!!!!!
...全文

相关推荐

JAVA项目学习笔记

通过做项目了解到一些只有在项目中才能遇到的问题,并自己尝试去解决问题,记录下来方便以后参考

smile_0325

JPA框架新技术: 注解

JDK1.6的新特性: 注解 其中介绍了JPA框架中的常用注解

hao982927760

软件开发工作词汇整理[可运行源码]

本文档详细整理了软件开发工作中常用的词汇和术语,涵盖了多个版本的内容更新,包括日语口语考试准备、日语音乐、保险术语、数据库模型、Java编程、网络协议等多个领域。文档中还包含了大量的日语词汇及其解释,以及一些技术术语的详细说明,如Java的transient关键字与JPA的@Transient注解的区别、数据库的三范式等。此外,还涉及了一些项目管理工具如Jenkins的使用方法,以及一些常见的错误类型和处理方式。内容全面且实用,适合软件开发人员参考和学习。

aa123

JPA注解的解释和说明.pdf

JPA 的最详细的说明,为你解答每一个注解的使用方法和技巧,帮您快速梳理思路,这是多少个字了????

爱吃早餐的程序员

Spring Boot中Spring data注解的使用

文章目录Spring Data Annotations@Transactional@NoRepositoryBean@Param@Id@Transient@CreatedBy, @LastModifiedBy, @CreatedDate, @LastModifiedDateSpring Data JPA Annotations@Query@Procedure@Lock@Modifying@EnableJpaRepositories Spring Boot中Spring data注解的使用 Sring data JPA为我们提供了很多有用的注解,方便我们来实现各种复杂的功能。本文我们将会从Spr

weixin_38506713
评论 11
收藏 已收藏
分享
返回顶部
vbagcl
Web 开发 81,107 成员 341,720 内容