- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 Netbeans 8.1 从和下载解决方案和托盘 2 教程P1。 Spring Hibernate Integration Example Tutorial (Spring 4 + Hibernate 3 and Hibernate 4)P2。 Spring MVC Hibernate MySQL Integration CRUD Example Tutorial最初的项目是用 Eclipse 做的。我用的是 Netbeans。
P1 工作正常。
当我运行 P2 时,我得到:
HTTP 状态 404 -和如下所示,未找到具有 URI 的 HTTP 请求的映射。
15-Apr-2016 14:59:46.813 INFO [http-apr-8080-exec-24] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\IT\apache-tomcat-8.0.32\conf\Catalina\localhost\SpringMVCHibernate.xml
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Fri Apr 15 14:59:57 CDT 2016]; root of context hierarchy
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/root-context.xml]
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 383 ms
INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization started
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing WebApplicationContext for namespace 'appServlet-servlet': startup date [Fri Apr 15 14:59:58 CDT 2016]; parent: Root WebApplicationContext
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]
INFO : org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/persons],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.journaldev.spring.PersonController.listPersons(org.springframework.ui.Model)
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/person/add],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.journaldev.spring.PersonController.addPerson(com.journaldev.spring.model.Person)
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/remove/{id}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.journaldev.spring.PersonController.removePerson(int)
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/edit/{id}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.journaldev.spring.PersonController.editPerson(int,org.springframework.ui.Model)
INFO : org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
INFO : org.hibernate.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
INFO : org.hibernate.Version - HHH000412: Hibernate Core {4.3.5.Final}
INFO : org.hibernate.cfg.Environment - HHH000206: hibernate.properties not found
INFO : org.hibernate.cfg.Environment - HHH000021: Bytecode provider name : javassist
INFO : org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
INFO : org.hibernate.engine.jdbc.internal.LobCreatorBuilder - HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
INFO : org.hibernate.engine.transaction.internal.TransactionFactoryInitiator - HHH000399: Using default transaction strategy (direct JDBC transactions)
INFO : org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory - HHH000397: Using ASTQueryTranslatorFactory
INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization completed in 8082 ms
15-Apr-2016 15:00:06.429 INFO [http-apr-8080-exec-24] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\IT\apache-tomcat-8.0.32\conf\Catalina\localhost\SpringMVCHibernate.xml has finished in 19,616 ms
15-Apr-2016 15:00:06.433 INFO [http-apr-8080-exec-22] org.apache.catalina.util.LifecycleBase.start The start() method was called on component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SpringMVCHibernate]] after start() had already been called. The second call will be ignored.
WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/SpringMVCHibernate/] in DispatcherServlet with name 'appServlet'
这是部署的内容:
Volume in drive C is OS
Volume Serial Number is ...
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
04/15/2016 02:59 PM <DIR> META-INF
04/15/2016 02:59 PM <DIR> WEB-INF
0 File(s) 0 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\META-INF
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
04/15/2016 07:45 AM 77 context.xml
04/15/2016 07:55 AM 125 MANIFEST.MF
04/15/2016 02:59 PM <DIR> maven
04/15/2016 07:55 AM 0 war-tracker
3 File(s) 202 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\META-INF\maven
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
04/15/2016 02:59 PM <DIR> com.journaldev.spring
0 File(s) 0 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\META-INF\maven\com.journaldev.spring
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
04/15/2016 02:59 PM <DIR> SpringMVCHibernate
0 File(s) 0 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\META-INF\maven\com.journaldev.spring\SpringMVCHibernate
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
04/15/2016 07:55 AM 144 pom.properties
04/15/2016 07:55 AM 6,127 pom.xml
2 File(s) 6,271 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\WEB-INF
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
04/15/2016 02:59 PM <DIR> classes
04/15/2016 02:59 PM <DIR> lib
04/15/2016 02:59 PM <DIR> spring
04/15/2016 02:59 PM <DIR> views
07/19/2014 08:58 PM 1,206 web.xml
1 File(s) 1,206 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\WEB-INF\classes
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
04/15/2016 02:59 PM <DIR> com
04/15/2016 07:55 AM 1,111 log4j.xml
1 File(s) 1,111 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\WEB-INF\classes\com
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
04/15/2016 02:59 PM <DIR> journaldev
0 File(s) 0 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\WEB-INF\classes\com\journaldev
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
04/15/2016 02:59 PM <DIR> spring
0 File(s) 0 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\WEB-INF\classes\com\journaldev\spring
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
04/15/2016 02:59 PM <DIR> dao
04/15/2016 02:59 PM <DIR> model
04/15/2016 07:55 AM 2,576 PersonController.class
04/15/2016 02:59 PM <DIR> service
1 File(s) 2,576 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\WEB-INF\classes\com\journaldev\spring\dao
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
04/15/2016 07:55 AM 428 PersonDAO.class
04/15/2016 07:55 AM 3,306 PersonDAOImpl.class
2 File(s) 3,734 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\WEB-INF\classes\com\journaldev\spring\model
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
04/15/2016 07:55 AM 1,534 Person.class
1 File(s) 1,534 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\WEB-INF\classes\com\journaldev\spring\service
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
04/15/2016 07:55 AM 440 PersonService.class
04/15/2016 07:55 AM 1,587 PersonServiceImpl.class
2 File(s) 2,027 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\WEB-INF\lib
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
02/28/2015 04:11 PM 445,288 antlr-2.7.7.jar
03/15/2015 11:53 AM 4,467 aopalliance-1.0.jar
04/06/2016 12:33 PM 119,683 aspectjrt-1.7.4.jar
03/15/2015 11:53 AM 160,519 commons-dbcp-1.4.jar
03/15/2015 11:53 AM 96,221 commons-pool-1.5.4.jar
02/28/2015 04:11 PM 313,898 dom4j-1.6.1.jar
03/15/2015 12:10 PM 75,311 hibernate-commons-annotations-4.0.4.Final.jar
03/15/2015 12:10 PM 5,230,007 hibernate-core-4.3.5.Final.jar
04/06/2016 12:33 PM 645,914 hibernate-entitymanager-4.3.5.Final.jar
02/28/2015 04:08 PM 113,371 hibernate-jpa-2.1-api-1.0.0.Final.jar
02/28/2015 04:11 PM 76,551 jandex-1.1.0.Final.jar
02/28/2015 04:11 PM 714,194 javassist-3.18.1-GA.jar
02/27/2015 11:25 AM 2,497 javax.inject-1.jar
02/28/2015 04:08 PM 57,183 jboss-logging-3.1.3.GA.jar
02/28/2015 04:08 PM 11,558 jboss-logging-annotations-1.2.0.Beta1.jar
02/28/2015 04:08 PM 27,717 jboss-transaction-api_1.2_spec-1.0.0.Final.jar
03/14/2015 08:32 AM 16,517 jcl-over-slf4j-1.7.5.jar
02/28/2015 04:11 PM 414,240 jstl-1.2.jar
03/16/2016 02:50 PM 391,834 log4j-1.2.15.jar
03/15/2015 11:53 AM 724,213 mysql-connector-java-5.1.9.jar
03/14/2015 08:32 AM 26,084 slf4j-api-1.7.5.jar
04/06/2016 09:46 AM 8,869 slf4j-log4j12-1.7.5.jar
03/15/2015 11:53 AM 352,700 spring-aop-4.0.3.RELEASE.jar
03/15/2015 11:53 AM 669,978 spring-beans-4.0.3.RELEASE.jar
03/15/2015 11:53 AM 974,938 spring-context-4.0.3.RELEASE.jar
03/15/2015 11:53 AM 973,502 spring-core-4.0.3.RELEASE.jar
03/15/2015 11:53 AM 204,745 spring-expression-4.0.3.RELEASE.jar
03/15/2015 11:53 AM 424,466 spring-jdbc-4.0.3.RELEASE.jar
03/15/2015 11:53 AM 366,892 spring-orm-4.0.3.RELEASE.jar
03/15/2015 11:53 AM 248,201 spring-tx-4.0.3.RELEASE.jar
04/09/2015 11:22 AM 667,960 spring-web-4.0.3.RELEASE.jar
04/09/2015 11:22 AM 662,385 spring-webmvc-4.0.3.RELEASE.jar
02/28/2015 04:12 PM 109,318 xml-apis-1.0.b2.jar
33 File(s) 15,331,221 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\WEB-INF\spring
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
04/15/2016 02:59 PM <DIR> appServlet
07/19/2014 08:58 PM 380 root-context.xml
1 File(s) 380 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\WEB-INF\spring\appServlet
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
07/19/2014 08:58 PM 3,242 servlet-context.xml
1 File(s) 3,242 bytes
... apache-tomcat-8.0.32\webapps\SpringMVCHibernate\WEB-INF\views
04/15/2016 02:59 PM <DIR> .
04/15/2016 02:59 PM <DIR> ..
07/19/2014 08:58 PM 2,484 person.jsp
1 File(s) 2,484 bytes
Total Files Listed:
49 File(s) 15,355,988 bytes
我的问题是只要我保留原始文件,我如何检测映射有什么问题?
感谢您的帮助。
米托马
更新
personControler.java
package com.journaldev.spring;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.journaldev.spring.model.Person;
import com.journaldev.spring.service.PersonService;
@Controller
public class PersonController {
private PersonService personService;
@Autowired(required=true)
@Qualifier(value="personService")
public void setPersonService(PersonService ps){
this.personService = ps;
}
@RequestMapping(value = "/persons", method = RequestMethod.GET)
public String listPersons(Model model) {
model.addAttribute("person", new Person());
model.addAttribute("listPersons", this.personService.listPersons());
return "person";
}
//For add and update person both
@RequestMapping(value= "/person/add", method = RequestMethod.POST)
public String addPerson(@ModelAttribute("person") Person p){
if(p.getId() == 0){
//new person, add it
this.personService.addPerson(p);
}else{
//existing person, call update
this.personService.updatePerson(p);
}
return "redirect:/persons";
}
@RequestMapping("/remove/{id}")
public String removePerson(@PathVariable("id") int id){
this.personService.removePerson(id);
return "redirect:/persons";
}
@RequestMapping("/edit/{id}")
public String editPerson(@PathVariable("id") int id, Model model){
model.addAttribute("person", this.personService.getPersonById(id));
model.addAttribute("listPersons", this.personService.listPersons());
return "person";
}
}
当我在 netbeas 中运行应用程序时,它是在服务器上部署和启动 web 的那个。我不是写url地址的人。
Netbeans 让我通过右键单击菜单(服务器 - tomcat - SpringMVCHibernate)来启动、停止、在浏览器中打开。
我尝试了一些其他的 url 地址,但没有成功。
所有来源都可以在P2的地址上看到。
更新
我更改了 log4j.xml 级别,下面是我在浏览器中打开的内容:
TRACE: org.springframework.web.servlet.DispatcherServlet - Bound request context to thread: uri: /SpringMVCHibernate/
method: GET
QueryString: null
Parameters:
Headers:
Name: host Value: localhost:8080
Name: user-agent Value: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0
Name: accept Value: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Name: accept-language Value: en-US,en;q=0.5
Name: accept-encoding Value: gzip, deflate
Name: dnt Value: 1
Name: connection Value: keep-alive
DEBUG: org.springframework.web.servlet.DispatcherServlet - DispatcherServlet with name 'appServlet' processing GET request for [/SpringMVCHibernate/]
TRACE: org.springframework.web.servlet.DispatcherServlet - Testing handler map [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping@43edc0b9] in DispatcherServlet with name 'appServlet'
DEBUG: org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Looking up handler method for path /
DEBUG: org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Did not find handler method for [/]
TRACE: org.springframework.web.servlet.DispatcherServlet - Testing handler map [org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping@170563eb] in DispatcherServlet with name 'appServlet'
TRACE: org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping - No handler mapping found for [/]
TRACE: org.springframework.web.servlet.DispatcherServlet - Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping@5256ecaa] in DispatcherServlet with name 'appServlet'
TRACE: org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - No handler mapping found for [/]
WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/SpringMVCHibernate/] in DispatcherServlet with name 'appServlet'
TRACE: org.springframework.web.servlet.DispatcherServlet - Cleared thread-bound request context: uri: /SpringMVCHibernate/
method: GET
QueryString: null
Parameters:
Headers:
Name: host Value: localhost:8080
Name: user-agent Value: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0
Name: accept Value: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Name: accept-language Value: en-US,en;q=0.5
Name: accept-encoding Value: gzip, deflate
Name: dnt Value: 1
Name: connection Value: keep-alive
DEBUG: org.springframework.web.servlet.DispatcherServlet - Successfully completed request
TRACE: org.springframework.web.context.support.XmlWebApplicationContext - Publishing event in WebApplicationContext for namespace 'appServlet-servlet': ServletRequestHandledEvent: url=[/SpringMVCHibernate/]; client=[127.0.0.1]; method=[GET]; servlet=[appServlet]; session=[null]; user=[null]; time=[2ms]; status=[OK]
TRACE: org.springframework.web.context.support.XmlWebApplicationContext - Publishing event in Root WebApplicationContext: ServletRequestHandledEvent: url=[/SpringMVCHibernate/]; client=[127.0.0.1]; method=[GET]; servlet=[appServlet]; session=[null]; user=[null]; time=[2ms]; status=[OK]
我认为一些相关的问题是:servlet-context.xml
、root-context.xml
和 web.xml
的预期用途是什么?
为什么 DispatcherServlet 会创建另一个应用程序上下文?
上下文初始化失败或加载属性
根上下文和调度程序 servlet 上下文到底是如何进入 Spring MVC Web 应用程序的?
尝试在 Eclipse 上运行示例并获得相同的结果:
WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/SpringMVCHibernate/] in DispatcherServlet with name 'appServlet'
仍然不知道如何修复以及如何检测应用程序有什么问题。感谢您的帮助。
最佳答案
您的项目中有一个 Controller
,它处理一组特定的 url。它在您项目的日志级别 INFO
中提及。
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/persons],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.journaldev.spring.PersonController.listPersons(org.springframework.ui.Model)
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/person/add],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.journaldev.spring.PersonController.addPerson(com.journaldev.spring.model.Person)
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/remove/{id}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.journaldev.spring.PersonController.removePerson(int)
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/edit/{id}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.journaldev.spring.PersonController.editPerson(int,org.springframework.ui.Model)
INFO : org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
它是:
/persons
/person/add
/remove/{id}
/edit/{id}
您收到的警告是因为您使用这种形式调用了 Url
:
http://localhost:xxxx/SpringMVCHibernate/
它没有映射到您的 servlet。
关于hibernate - spring、hibernate、MVC,如何检测映射有什么问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36656127/
什么是 hibernate 和n- hibernate ?我可以在 Visual Studio 2008 中使用它进行 C# Web 应用程序开发吗?请给我建议...我是 asp.net Web 应用
我有一个不系统地发生的异常(exception)。 我试图通过在每次迭代中刷新和清理 session 来解决此问题,但没有成功。 [quartzScheduler_Worker-7] ERROR jd
使用 Hibernate 在数据库中存储 IP 地址的最佳类型是什么? 我虽然是 Byte[] 或 String,但有没有更好的方法,或者你用什么? @Column(name = "range_fr
我正在尝试制定一个公式来选择用户个人资料的用户友好名称。它选择名字 + ' ' + 姓氏 如果其中至少有一个不为空且不为空(包含非空白字符),否则选择 短名称 (条件相同),最后,如果 短名称 为空或
在hibernate中,是否可以将鉴别器作为一个实体?例如,如果我将 Department 作为基类,将 AdminDepartment 和 ProcessingDepartment 作为子类。 De
我只想从表中获取一些列值。因此,我已经使用投影来实现这一目标。该代码有效,但我认为它无效。 我的问题是当我使用ProjectionsList并将标准条件列表设置为ArrayList时-Bulletin
你好: 我对 hibernate 缓存缓存的内容感到困惑。 从文档中,我知道 hibernate 中有缓存类型。 一级 :交易级别。 似乎要被 session 持久化的实体被缓存在这里。 二级缓存 :
我遇到了一个情况: save或update hibernate 的目标表中的某些数据 在目标表上有一个触发器,该触发器将在目标表的insert或update操作之前执行 由 hibernate 将此记
我有一个名为 Master_Info_tbl 的表。它是一个查询表: 这是该表的代码: @Entity @Table(name="MASTER_INFO_T") public class Code
我想知道如何在 Hibernate 查询语言中使用日期文字。我在我的 JPA 项目中做了如下操作(作为 Eclipselink 提供者)并且它工作正常。 SELECT m FROM Me m WHER
@Entity public class Troop { @OneToMany(mappedBy="troop") public Set getSoldiers() { ...
我正在尝试使用 hibernate 查询删除表 'user_role' 中的所有行。但每次我都会出错。有人可以帮我吗。 DaoImpl @Override public void deleteAll(
不是将数据库操作分散在四个 (osgi) 包中,而是在那里做略有不同的事情。我想创建一个负责所有持久性问题的(简单的)OSGi 包。我觉得这并不像听起来那么简单,因为“每个包都有独特的类加载器”。 因
这就是我使用生成器的方式: private Integer id; 我看到的行为是: 创建第一个对象 hibernate 分配 id = 1 删除该对象 关闭服务
对象级别的实体和值类型有什么区别。我知道实体将有一个 id 但值不会,但为什么我们需要不同的方法来映射实体与值类型? 这样做是为了让hibernate可以对值类型应用任何优化吗? 最佳答案 一个实体已
我正在使用 HibernateTemplate.findByCriteria 方法进行一些查询。现在我想在标准上创建一些 SQL 限制,比如 criteria.add(Restrictions.sql
所以我有以下代码: Query query = session.createQuery("from Weather"); List list = query.list();
如何使用Hibernate映射具有多个实体的 View ? 问候, 混沌 最佳答案 请参见Hibernate文档中第5.1.3节“类”,紧接在“Id”节之前: There is no differen
据我所知,Hibernate 有两种类型的实现 JPA的实现(2)(@Entity,@Table注解) 扩展到旧的(传统的) hibernate (没有 JPA),使用 HSQL 查询,没有注释 如果
我需要一个将条目存储为键值对的集合(因此我可以通过键查找值),但我需要一个允许多个值使用 hibernate 共享同一个键的集合 最佳答案 一个键具有多个值的映射称为多映射 - 在 Apache 公共
我是一名优秀的程序员,十分优秀!