我正在尝试编写一个触发器,我有以下表格:BookingRequest:
+-----------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------+------+-----+---------+----------------+
| idRequest | int(11) | NO | PRI | NULL | auto_increment |
| roomClass | int(11) | NO | | NULL | |
| inDate | date | NO | | NULL | |
| outDate | date | NO | | NULL | |
| numOfBeds | int(11) | NO | | NULL | |
| status | int(11) | NO | …Run Code Online (Sandbox Code Playgroud) 我不能使这个查询工作:
Query query = eManager.createQuery("select c FROM News c WHERE c.NEWSID = :id",News.class);
return (News)query.setParameter("id", newsId).getSingleResult();
Run Code Online (Sandbox Code Playgroud)
我得到了这个例外:
Exception Description: Problem compiling [select c FROM News c WHERE c.NEWSID = :id].
[27, 35] The state field path 'c.NEWSID' cannot be resolved to a valid type.] with root cause
Local Exception Stack:
Exception [EclipseLink-0] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Problem compiling [select c FROM News c WHERE c.NEWSID = :id].
Run Code Online (Sandbox Code Playgroud)
为什么会这样?:id和命名参数是相同的
编辑: 我的实体类
@Entity
@Table(name="NEWS")
public class News implements …Run Code Online (Sandbox Code Playgroud) 我需要使用xalan重定向扩展名将新元素添加到现有xml文件中,但是命名空间存在问题。
my xslt :
<xsl:stylesheet version="1.0"
xmlns:redirect="http://xml.apache.org/xalan/redirect"
extension-element-prefixes="redirect" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:validator="xalan://com.epam.app.transformation.Validator"
xmlns:t="http://www.products.com" exclude-result-prefixes="#default t">
<xsl:import href="addProductPage.xsl" />
<xsl:param name="name"></xsl:param>
<xsl:param name="provider"></xsl:param>
<xsl:param name="model"></xsl:param>
<xsl:param name="color"></xsl:param>
<xsl:param name="dateOfIssue"></xsl:param>
<xsl:param name="notInStock"></xsl:param>
<xsl:param name="price"></xsl:param>
<xsl:param name="filename"></xsl:param>
<xsl:param name="isValid"
select="validator:validateFields($name, $provider, $model, $dateOfIssue, $color,$price,$notInStock)" />
<xsl:param name="categoryName"></xsl:param>
<xsl:param name="subcategoryName"></xsl:param>
<xsl:output omit-xml-declaration="yes" indent="no" />
<xsl:template match="/" priority="2">
<html>
<head>
<title>Products Home Page</title>
</head>
<body>
<xsl:choose>
<xsl:when test="$isValid">
<redirect:write select="$filename" append="false">
<xsl:call-template name="saveProduct" />
</redirect:write>
<xsl:call-template name="returnToProducts" />
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="addProduct" />
<!-- i show errors …Run Code Online (Sandbox Code Playgroud)