Hibernate:为什么要使用O / R映射?(Hibernate: why use O/R mapping?)
我是Hibernate的新手。
1)我不太明白为什么我们需要在* .hbm.xml文件中指定O / R映射关系,或者在数据集中添加“一对一”,“一对多”等注释。 拥有它们是必须的吗? O / R映射关系如何真正在幕后工作?
2)添加* .hbm.xml与databean注释的关系有什么区别? 我们应该两个都做吗? 每个人的优点和缺点是什么?
I'm new to Hibernate.
1) I don't quite understand why we need to specify O/R mapping relationship in *.hbm.xml file or add annotations for "one-to-one", "one-to-many", etc in databeans. Is it a must to have them? How does O/R mapping relationship really work behind the scene?
2) What is the difference between adding relationship to *.hbm.xml and databean annotation? Should we do both? Advantages and disadvantages for each of them?
原文:https://stackoverflow.com/questions/38507803
最满意答案
代替:
if(currentPosition == numberOfSlides - 1) { currentPosition = 0; } else { currentPosition++; }
您需要将第一张幻灯片移动到最后(并同时调整容器的位置):
if (currentPosition > 0) { $('#slidesHolder').css('marginLeft',0) .children().first().appendTo('#slidesHolder'); } else { currentPosition += 1; }
http://jsfiddle.net/mblase75/qatry/
或者,为了更好地优化整个事物,您可以消除
currentPosition
变量和moveSlide
子函数,并在.animate
方法中使用回调:function changePosition() { $('#slidesHolder').animate({ 'marginLeft': 0-slideWidth }, function() { $('#slidesHolder').css('marginLeft', 0) .children().first().appendTo('#slidesHolder'); }); }
Instead of:
if(currentPosition == numberOfSlides - 1) { currentPosition = 0; } else { currentPosition++; }
You need to move the first slide to the very end (and adjust the position of the container at the same time):
if (currentPosition > 0) { $('#slidesHolder').css('marginLeft',0) .children().first().appendTo('#slidesHolder'); } else { currentPosition += 1; }
http://jsfiddle.net/mblase75/qatry/
Or, to optimize the whole thing a little more, you can eliminate the
currentPosition
variable and themoveSlide
sub-function, and just use a callback in the.animate
method:function changePosition() { $('#slidesHolder').animate({ 'marginLeft': 0-slideWidth }, function() { $('#slidesHolder').css('marginLeft', 0) .children().first().appendTo('#slidesHolder'); }); }
相关问答
更多-
答案是,一旦任一个效果被激活,它将从元素中取出内联CSS属性“display = none”。 这些隐藏效果需要将display属性设置为“none”。 所以,只需重新排列方法的顺序,并在渐变和幻灯片之间的链中添加一个css-modifier。 $('#anotherDiv').hover(function() { $('#myDiv').stop(true, true).fadeIn({ duration: slideDuration, queue: false }).css('display', ...
-
首先你应该包含jQuery库,然后有几个错误(JS和CSS)。 看这里: $(".items .title-bar").on("mouseover", function () { $(this).closest(".items").find(".car-info").slideDown(); //@Vedant Terkar edit }); $(".items .title-bar").on("mouseout", function () { $(this).closest ...
-
滑动UITableViewCell(Slide UITableViewCell)[2021-11-29]
UITableView提供了用动画插入和删除行的方法,并为您处理所有的动画。 尝试这样的事情: [tableView beginUpdates]; [tableView deleteRowsAtIndexPaths:myIndexPaths withRowAnimation:UITableViewCellRowAnimationRight]; [tableView endUpdates]; 然后在新的单元格中滑动: [tableView beginUpdates]; [t ... -
代替: if(currentPosition == numberOfSlides - 1) { currentPosition = 0; } else { currentPosition++; } 您需要将第一张幻灯片移动到最后(并同时调整容器的位置): if (currentPosition > 0) { $('#slidesHolder').css('marginLeft',0) .children().first().appendTo('#slidesHold ...
-
jQuery菜单向右滑动(jQuery menu slide right)[2023-05-28]
这是正确的代码。 经过测试,整洁和工作。 请享用! http://jsfiddle.net/ReuLr/6/ Here is the correct code. Tested, tidy and working. Enjoy! http://jsfiddle.net/ReuLr/6/ -
查看本教程和示例http://www.queness.com/post/356/create-a-vertical-horizontal-and-diagonal-sliding-content-website-with-jquery 基本上,您必须将CSS和HTML设置为将所需的所有面板/屏幕作为div(行和列)。 然后为每个面板设置一个选择器并绑定一个单击事件[来自链接的代码] 。 $(document).ready(function() { //get all link with class ...
-
您的动画正在排队,请使用.stop() : jQuery(window).scroll(function () { if (jQuery(this).scrollTop() > 100) { if (jQuery('.totop').hasClass('visible') == false) { jQuery('.totop').stop().animate({ right: '0px' }, funct ...
-
Jquery向上滑动div(Jquery slide up divs)[2023-06-25]
你在尝试这样的事吗? HTML: