什么时候在hibernate中使用DiscriminatorValue注释的最佳方案是什么?
最近我一直在处理存储过程并遇到一个奇怪的问题.
首先,我能够通过以下方式从数据库成功调用存储过程:
IList <XXXViewModel> XXXList = _context.Database.SqlQuery("spXXX").ToList();
但是当我需要传递参数时,它失败了:
var parameters = new List<SqlParameter>();
parameters.Add(new SqlParameter("param1", param1Value));
parameters.Add(new SqlParameter("param2", param2Value));
IList<XXXViewModel> XXXList =
_context.Database.SqlQuery<XXXViewModel>("spXXX @param1, @param2", parameters).ToList();
Run Code Online (Sandbox Code Playgroud)
我得到了ff,错误:
从对象类型System.Collections.Generic.List`1 [[System.Data.SqlClient.SqlParameter,System.Data,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089]]到已知的托管提供者本机不存在映射类型.
请注意,我也尝试过:
_context.Database.ExecuteSqlCommand<EXEC XXXViewModel>("spXXX @param1, @param2", parameters).ToList();
Run Code Online (Sandbox Code Playgroud)
但得到了相同的结果:-(.
我也尝试通过指定每个参数来调用:
IList<XXXResult> query = Context.Database.SqlQuery<XXXResult>("SP @paramA, @paramB, @paramC", new SqlParameter("paramA", "A"), new SqlParameter("paramB", "B"), new SqlParameter("paramC", "C")).ToList();
Run Code Online (Sandbox Code Playgroud)
任何人有任何想法?
我目前遇到了JSF执行顺序的问题.
看看我的示例代码:
<p:commandButton action="update.xhtml" ajax="false"
icon="ui-icon-pencil"
actionListener="#{marketingCodeBean.initForUpdate}">
<f:setPropertyActionListener
target="#{marketingCodeBean.marketingCode}" value="#{code}"></f:setPropertyActionListener>
</p:commandButton>
Run Code Online (Sandbox Code Playgroud)
我想使用setPropertyActionListener设置bean属性,并对actionListener = initForUpdate进行一些处理.但是JSF默认执行顺序是相反的,actionListener首先在setPropertyActionListener之前.这个问题有干净的解决方法吗?
我正在考虑使用actionListener并将bean参数传递给它,但我不确定这是否是最好的方法.
我正在使用C#和MVC3.
我有一个页面,例如学生列表,显示学生列表,这是由数据库驱动的.同时我的菜单是数据库驱动的,所以我也必须将它发送到视图.
如何将两个模型发送到单个视图?
我目前遇到了这个问题,在迁移到eclipse-jee-kepler之前我没有这个问题.是)我有的:
我有2个类,基类和扩展类:
public abstract class BaseEntity implements Serializable {
@Id
@GeneratedValue(generator = "ID_GENERATOR")
@Column(name = "ID")
private Long id;
}
@Entity
@Table(name = "CUSTOMER")
@SequenceGenerator(name = "ID_GENERATOR", sequenceName = "CUSTOMER_SEQ")
public class Customer extends BaseEntity {
}
Run Code Online (Sandbox Code Playgroud)
在我没有这个验证错误之前,但现在eclipse正在抛出它.我可以成功编译,构建和部署,但错误标记使得在你真正拥有编译错误时难以查明编译错误.
错误似乎很明显,因为我在所有扩展类上都有ID_GENERATOR.我的问题:1.)我可以忽略这个错误吗?2.)任何解决方法?可能使用不同的方法.
我想懒惰加载我的模块,但同时使用canActivate保护它.我试过了:
{ path: 'dashboard/vendor', canActivate: AuthGuard, loadChildren: 'app/module/dashboard/vendor/vendor.module#VendorModule' }
Run Code Online (Sandbox Code Playgroud)
请注意,我没有使用子项,因为我使用RouterModule.forChild在vendor-routing.module中定义了供应商路由.
但它不起作用.有什么建议?
有人遇到以下问题吗?
我能够使用jboss工具在eclipse中的jboss中成功构建,部署和运行我的javaee6应用程序。但是,当我们将其部署在独立运行的另一台服务器上时,出现了错误。我在eclipse所在的同一台机器上尝试过,并在jboss上独立运行,并得到了相同的错误。
看到下面的错误,我已经删除了一些零件。
06:53:46,423 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/127.0.0.1:8080-1) Transaction cannot proceed STATUS_MARKED_ROLLBACK
06:53:46,424 ERROR [org.jboss.as.ejb3.invocation] (http-/127.0.0.1:8080-1) JBAS014134: EJB Invocation failed on component OfferTemplateServiceApi for method public void org.meveo.asg.api.OfferTemplateServiceApi.preProcessRequest(org.meveo.api.dto.OfferDto) throws org.meveo.api.exception.MeveoApiException: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleEndTransactionException(CMTTxInterceptor.java:114) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:94) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:252) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:339) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:216) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]
at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]
at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) …Run Code Online (Sandbox Code Playgroud) 在VS2010中创建Web应用程序项目后,添加路由路由并在调试模式下运行,路由似乎正常工作,我没有问题.
但是,当我尝试在我的本地计算机上的IIS7.5上部署它,并尝试单击使用路由的链接时,它会抛出:"HTTP错误404.0 - 未找到您要查找的资源已被删除,其名称已更改,或暂时无法使用."
有没有人遇到过同样的问题?
我已经处理这个问题几个小时了,似乎我做错了什么。
首先,svn 的 post-commit 钩子已经可以工作了,因为我已经能够看到日志了,这里是 post-commit 的代码:
#!/bin/sh
REPOS="$1"
REV="$2"
UUID=`svnlook uuid $REPOS`
/bin/echo "$REPOS $REV $UUID" >> /var/subversion/svn-post-commit.out
Run Code Online (Sandbox Code Playgroud)
请注意,要使其工作,您需要执行 chmod 777 以提交后并执行 chown www-data:www-data 到 svn 存储库。
不起作用的是 jenkins notifyCommit,它会在 jenkins 中自动构建项目:
/usr/bin/wget \
--header "Content-Type:text/plain;charset=UTF-8" \
--post-data "'svnlook changed --revision $REV $REPOS'" \
--output-document "-" \
--timeout=2 \
http://localhost:8080/subversion/${UUID}/notifyCommit?rev=$REV
Run Code Online (Sandbox Code Playgroud)
我也尝试通过 curl 调用
curl --data "rev=4" http://localhost:8080/subversion/c8bb87ec-9a19-4975-ab9d-8b15741e6d7e/notifyCommit
Run Code Online (Sandbox Code Playgroud)
没有错误,但詹金斯没有建立。
有任何想法吗?
卷发的回复:
* About to connect() to 10.1.1.133 port 8080 (#0)
* Trying 10.1.1.133... connected
> POST /subversion/c8bb87ec-9a19-4975-ab9d-8b15741e6d7e/notifyCommit HTTP/1.1
> User-Agent: …Run Code Online (Sandbox Code Playgroud)