草庐IT

Entity-Framework

全部标签

java - Entity-Bean (JPA) 中的单向关系

如何在EJB3.0Entity-Beans(JPA)中创建单向关系?例如,客户知道订单,但订单没有客户的任何方法。使用(@OneToMany或@OneToOne或@ManyToMany)问候 最佳答案 下面是使用JPA2.0建立单向@OneToMany关系的方法:@EntitypublicclassCustomer{@Id@Column(name="cust_id")privatelongid;...@OneToMany@JoinColumn(name="owner_id",referencedColumnName="cust_id

java - Play Framework 2.4 不接受 Controller 的 "public static Result"

我尝试在Mac中使用PlayFramework2.4和JDK8启动应用程序,当我使用./activatornewProjectplay-java下载基础时,模板代码包含下一个:项目/app/controlles/Application.javapackagecontrollers;importplay.*;importplay.mvc.*;importviews.html.*;publicclassApplicationextendsController{publicResultindex(){returnok(index.render("Yournewapplicationisrea

java - JPA/Spring/Delete Entity,类型不匹配(int/long for id)

我有一个使用的实体@Id@GeneratedValue(strategy=GenerationType.AUTO)privatelongid;我有这个实体的JPA存储库。现在我想删除其中一个,但标准方法是delete(inti),它不起作用,因为我的ID不是整数,而是长整数。那么除了使用int作为我的ID之外,在这里还能做什么?我可以指定一个使用long的自定义删除方法,就像它与findbyXX(XX)一起使用一样吗?编辑:首先:是的,我正在使用DataJPA!我想这样做:jparepository.delete(id);如果id是一个整数:org.hibernate.TypeMism

java - Play Framework 中的完整目标/当前 URL?

关于如何使用play框架获取当前URL的任何想法?我也在寻找完整的目标URL。我知道我可以使用@{Controller.method}但我需要完整的url(对于Facebook点赞按钮) 最佳答案 使用@@创建绝对路径所以,你会使用@@{Controller.method}但是,要获取当前路径,无需指定特定的Controller和操作,您可以使用${request.url} 关于java-PlayFramework中的完整目标/当前URL?,我们在StackOverflow上找到一个类似

java - Play Framework : PersistenceException: The type is not a registered entity? (Ebean)

我正在学习适用于Java的PlayFramework2.0教程,但在尝试保存ebean模型(task.save())时遇到此错误。[PersistenceException:Thetype[classmodels.Task]isnotaregisteredentity?Ifyoudon'texplicitlylisttheentityclassestouseEbeanwillsearchforthemintheclasspath.IftheentityisinaJarchecktheebean.search.jarspropertyinebean.propertiesfileorche

java - org.hibernate.HibernateException : Unable to instantiate default tuplizer [org. hibernate.tuple.entity.PojoEntityTuplizer]

我正在尝试学习使用hibernate将一条简单的记录插入MySQL数据库,我正在关注这个article来自Mkyong,我卡在了最后一步,即运行App.Java时。请帮助。提前致谢。pom.xml:4.0.0com.mkyong.commonHibernateExamplejar1.0-SNAPSHOTHibernateExamplehttp://maven.apache.orgjunitjunit3.8.1testmysqlmysql-connector-java5.1.9org.hibernatehibernate-core3.6.3.Finaldom4jdom4j1.6.1com

java - 得到一个 The entity name must immediately follow the '&' in the entity reference error in java, 但我的 xml 文件中没有任何符号

我遇到了错误Theentitynamemustimmediatelyfollowthe'&'intheentityreference.但我的XML文档中没有任何符号!有谁知道为什么会发生这种情况?这是我要解析的XML文档:BestiPadstrategygameshttp://feedproxy.google.com/~r/TheIphoneBlog/~3/198mhX3FVmw/story01.htmShareyourlifewithfriendsinrealtimewithSpinhttp://feedproxy.google.com/~r/TheIphoneBlog/~3/9G8

Mac 上的 Java 7 和 JavaVM.framework

我在mac上玩了一下Java7update9,发现了一件有趣的事情。我刚刚使用JFrame运行了一个简单的Java程序,并使用lldb附加到它。然后我检查了这个Java程序加载的库,我看到了:"/System/Library/Frameworks/JavaVM.framework/JavaVM"在里面。所以我有两个问题:这个JavaVM为Java7做了什么?我认为Mac上的Java7与其在Windows和Linux上的相应版本一样是自洽的。通过使用“nm”,我可以看到这个JavaVM定义了很多函数,比如JNI_CreateJavaVM,它也在libjvm.dylib中定义。对于Java

java - 如何在 Spring Framework 中实现 i18n(带有 gTLD 的子目录)?

我正在开发一个使用SpringFramework、Spring(MVC)、SpringSecurity等的Web应用程序...Spring文档显示国际化在URL中添加一个参数(例如http://myexample.com?lang=fr)但是我已经通过谷歌阅读了这篇文章"Multi-regionalandmultilingualsites"其中声明不推荐这种做法。所以我决定这样实现:http://myexample.com/->默认语言环境(EN)http://myexample.com/es/->语言环境eshttp://myexample.com/fr/->语言环境fr我的问题是:

java - Play Framework : Mixing Java and Scala controller/views

在built.sbt文件中有一个设置.enablePlugins(PlayScala)将我的项目设置为scala。现在我也想使用Java。我发现有两个版本的data.Form(play.data._和importplay.api.data._)。所以我为参数列表使用了完全限定类型。@(loginForm:play.data.Form[User_LoginForm])@importhelpers._@helper.form(action=routes.ApplicationJava.login(),'id->"loginForm"){@helper.inputText(loginForm