我正在使用Appfuse来开发我的应用程序。我有一个例外如下。 我想hibernate映射有一个问题,特殊列名 ADSL_DEVICE.VALIDATE (使用表示法)会导致错误。请帮我解决这个问题。
Hibernate:从双重中选择NODE_ID_SEQ.nextval Hibernate:插入NODE(AREA_ID,DESCRIPTION,FIRMWARE_VERSION,IS_ENABLE,IS_VISIBLE,MIB_VERSION,NAME,PARENT_ID,NODE_TYPE_ID,SERIAL_NUMBER,SHORT_NAME,ID)值(?,?,?,?,?,?,?,?,?, ?,?,?)
Hibernate:插入ADSL_DEVICE(ADSL_NAME,ADSL_SERIAL_NUMBER,CONNECTION_REQUEST,HARDWARE_VERSION,IP_ADDRESS,MANUFACTURER,OUI,PRODUCT_CLASS,PROVISIONING_CODE,SOFTWARE_VERSION, VALIDATE ,NODE_ID)值(?,?,?,? ,?,?,?,?,?,?,?,?)
WARN - SqlExceptionHelper.logExceptions(143)| SQL错误:1747,SQLState:42000
错误 - SqlExceptionHelper.logExceptions(144)| ORA-01747:user.table.column,table.column或列规范无效测试运行:1,失败:0,错误:1,跳过:0,经过的时间:9.289秒<<<失败! testAddAdslFirmware(org.appfuse.dao.AdslDeviceDaoTest)经过的时间:8.249秒<<<错误! org.hibernate.exception.SQLGrammarException:ORA-01747:user.table.column,table.column或列规范无效
@Entity
@Table(name = AdslDevice.TABLE_NAME, uniqueConstraints =
@UniqueConstraint(columnNames = AdslDevice.SERIAL_NUMBER))
@PrimaryKeyJoinColumn(name = AdslDevice.NODE_ID)
public class AdslDevice
extends Node
implements java.io.Serializable {
// Constant
public static final String TABLE_NAME = "ADSL_DEVICE";
public static final String NODE_ID = "NODE_ID";
public static final String ADSL_NAME = "ADSL_NAME";
public static final String SERIAL_NUMBER = "ADSL_SERIAL_NUMBER";
....
@Column(name = "\"VALIDATE\"", length = 1)
public String getValidate() {
return this.validate;
}
public void setValidate(String validate) {
this.validate = validate;
}
....
}
Hibernate:从dual中选择NODE_ID_SEQ.nextval Hibernate:插入NODE(AREA_ID,DESCRIPTION,FIRMWARE_VERSION,IS_ENABLE,IS_VISIBLE,MIB_VERSION,NAME,PARENT_ID,NODE_TYPE_ID,SERIAL_NUMBER,SHORT_NAME,ID)值(?,?,?,?,?,?,?,?,?, ?,?,?)
Hibernate:插入ADSL_DEVICE(ADSL_NAME,ADSL_SERIAL_NUMBER,CONNECTION_REQUEST,HARDWARE_VERSION,IP_ADDRESS,MANUFACTURER,OUI,PRODUCT_CLASS,PROVISIONING_CODE,SOFTWARE_VERSION,“VALIDATE”,NODE_ID)值(?,?,?,?,?,?, ?,?,?,?,?,?)
AdslDeviceDao类从Appfuse
扩展GenericDaopublic class AdslDeviceDaoTest extends BaseDaoTestCase {
@Autowired
private AdslDeviceDao adslDeviceDao;
@Test
public void testAddAdslFirmware() {
NodeType type = new NodeType();
type.setId(1L);
AdslDevice node = new AdslDevice();
// Node values
node.setArea(new Area(1L, "Ha noi"));
node.setDescription("Node desc");
node.setFirmwareVersion("1.0");
node.setIsEnable((short)1);
node.setIsVisible((short)1);
node.setMibVersion("v1");
node.setName("Node name");
node.setNodeType(type);
node.setSerialNumber("4578787864896");
node.setShortName("S1");
// adsl values
node.setAdslName("Adsl name");
node.setAdslSerialNumber("4578787864896");
node.setHardwareVersion("1.0");
node.setIpAddress("10.2.4.58");
node.setManufacturer("Vnpttech");
node.setOui("6.1.2.3");
node.setProductClass("Product class");
node.setProvisioningCode("6630");
node.setSoftwareVersion("11");
node.setValidate("1");
Node nodenew = adslDeviceDao.save(node);
flush();
assertEquals("F23", nodenew.getName());
assertNotNull(nodenew.getId());
}
}
谢谢!