草庐IT

data-tools-id

全部标签

java - 使用给定的字段对象 id 而不是对象本身存储 JPA 实体

问题如下:我们有实体:@EntitypublicclassFeedback{@Id@GeneratedValue(generator="token")privateStringid;@ManyToOneprivateProductproduct;privateStringmessage;//otherfields}我们有一个服务器端点,它接收来自客户端的反馈。以多部分/基于表单的格式收到的反馈,包含以下字段:ProductId-productidentifierMessage-feedbackmessageSomeotherfields要设置Feedback.product,我们需要从

带有类选择器的javaFX css id选择器不起作用

编辑(9/05/2016):检查我写的答案..Part1我为应用程序的所有TabPanes使用此css:.tab-pane.tab-header-area.tab-header-background{-fx-opacity:0.0;}.tab-pane{-fx-tab-min-width:90.0px;}.tab-pane.tab{-fx-background-color:orange;-fx-background-radius:0.020.00.020.0;-fx-focus-color:transparent;-fx-faint-focus-color:transparent;}.

java - 如何将 hibernate @DynamicUpdate 与 spring data jpa 一起使用?

我正在使用springdata-jpa。我只想更新一列。我的仓库是;publicinterfaceUserRepositoryextendsJpaRepository{}我的服务是;publicUsersave(Useruser){returnuserRepository.save(user);}我的实体;@Entity@DynamicUpdate(true)publicclassUserimplementsSerializable{//columndefinitions,etc.}如何只更新User中的一列? 最佳答案 首先,我想

java - 无法在 Spring Data Repository 中创建自定义查询方法

这个问题在这里已经有了答案:HowtoaddcustommethodtoSpringDataJPA(13个答案)关闭4年前。我想创建自定义存储库:publicinterfaceFriendRepositoryCustom{PagefindFriends(FriendCriteriafriendCriteria,Pageablepageable);}及其实现:@Repository@Transactional(readOnly=true)publicclassFriendRepositoryCustomImplimplementsFriendRepositoryCustom{@Persi

java - 是否有行为类似于自动 ID SQL 表的 Java 集合(或类似集合)?

请注意,我实际上并没有在这里对数据库做任何事情,所以ORM工具可能不是我要找的东西。我想要一些容器,每个容器都包含一些对象,一个容器中的所有对象都属于同一类。容器应该显示数据库表的一些行为,即:允许将对象的字段之一用作唯一键,即。e.在该字段中具有相同值的其他对象不会添加到容器中。接受新对象后,容器应发出一个数字ID,该ID返回给插入方法的调用者。容器不应在请求“重复条目”时抛出错误,而应跳过插入并返回已存在对象的键。现在,我将编写一个通用容器类,它接受实现接口(interface)的对象以获取键字段的值,并使用以这些值作为键值的HashMap作为实际存储类。是否有更好的方法使用现有的

java - HttpSession ID 有多独特?

我将通过在他/她的cookie中存储唯一ID来唯一标识用户。HttpSessionID是我谷歌搜索的一个不错的选择。只是想知道它有多独特?它是webcontainer独有的还是一旦过期,它会重新生成吗?如果它重复,我所有的用户登录都可以去折腾。需要一些关于使用sessonID作为我的用户的唯一标识符的专家意见。 最佳答案 sessionID仅在session的生命周期内是唯一且有意义的。sessionID标识一个session:仅此而已。它不识别用户。您不能也不应该依赖重复使用的sessionID,更不用说针对同一用户了。

java - Spring Data 网页分页 "page"参数不起作用

我正在尝试让SpringData的Web分页正常工作。在这里描述:http://static.springsource.org/spring-data/data-jpa/docs/current/reference/html/repositories.html#web-pagination这是我的Java(SpringWebMVC@Controller处理程序方法):@RequestMapping(value="/list",method=RequestMethod.GET)publicStringlist(@PageableDefaults(value=50,pageNumber=0

java - Spring Data Rest - 具有默认值的参数

我创建了以下@RepositoryRestResource查询,我想在其中为我的restapi创建一个动态查询。所以基本上我想做类似的事情:myHost/myApp/data/search/all?name=me&age=20&address=myhome&etc=etc所以我创建了以下查询:@Query("SelecttfromDatat"+"where"+"t.namelike:nameAND"+"t.age=:ageAND"+"t.address=:addressAND"+"t.etc=:etc"@RestResource(path="all",rel="all")Pagefin

java - 使用 JPA 覆盖 @MappedSuperclass 中定义的 @Id

我有一个AbstractEntity类,它由我的应用程序中的所有实体扩展,基本上充当标识符提供者。@MappedSuperclasspublicclassAbstractEntityimplementsDomainEntity{privatestaticfinallongserialVersionUID=1L;/**Thisobject'sid*/@Id@GeneratedValue(strategy=GenerationType.AUTO)protectedlongid;@Temporal(TemporalType.TIMESTAMP)@Column(name="creation_d

java - Spring Data JPA 存储库抛出空指针

这个问题在这里已经有了答案:WhyismySpring@Autowiredfieldnull?(21个回答)关闭6年前。我一直在使用SpringBoot和SpringData。通过JavaConfig文档,我已经设置了一个SpringJPA配置,但是当在我的存储库中调用save方法时,会抛出一个空指针。我的仓库:importorg.springframework.data.jpa.repository.JpaRepository;publicinterfaceHouseRepositoryextendsJpaRepository{}我的POJO:抽象屋@MappedSuperclass