首页 \ 问答 \ 具有多个字段的OrmLite UpdateOnly示例(Example of OrmLite UpdateOnly with Multiple Fields)

具有多个字段的OrmLite UpdateOnly示例(Example of OrmLite UpdateOnly with Multiple Fields)

是否可以使用OrmLite扩展方法UpdateOnly一次更新多个字段?

文档中给出的示例是:

db.UpdateOnly(new Person { FirstName = "JJ" }, p => p.FirstName);

我可以提供包含多个字段的表达式吗? 如果是这样,那么最好的运算符是什么,因为字段可能是不同的数据类型。


Is it possible to use the OrmLite extension method UpdateOnly to update multiple fields at once?

The example given in the documentation is:

db.UpdateOnly(new Person { FirstName = "JJ" }, p => p.FirstName);

Can I provide an expression with multiple fields in it? If so, what's the best operator to use given that the fields may be different data types.


原文:https://stackoverflow.com/questions/15578690
更新时间:2023-11-17 20:11

最满意答案

错误:在StdDraw类中找不到主要方法

意味着1)它缺少一个main方法和2)你目前在eclipse设置中有项目来运行StdDraw类。

尝试右键单击左窗格中的Lineage类(或文件视图打开的位置)并选择“运行方式> Java应用程序”(不记得确切的内容)


Error: Main method not found in class StdDraw

Means 1) it's missing a main method and 2) you currently have the project in eclipse setup to run the StdDraw class.

Try right-clicking on your Lineage class in the left pane (or where the files view is open) and choose "Run as > Java application" (can't remember exactly what it says)

相关问答

更多
  • 我想你使用这样的代码。 public class TestClass { public static void main(String[] args) { doSth(); } public void doSth() { } 你不能从主类中调用非静态方法。 如果你想从你的主类调用一个非静态方法,请像这样实例化你的类: TestClass test = new TestClass(); test.doSth(); 并调用该方法。 I guess you using a code like t ...
  • 您可以重载main()方法,但只有当您的类由JVM启动时,才会使用public static void main(String[] args) 。 例如: public class Test { public static void main(String[] args) { System.out.println("main(String[] args)"); } public static void main(String arg1) { Syst ...
  • 你不能导入非静态方法(只有类和静态成员),而你不必! 如果你的两个类都存在于默认包中,那么你应该能够在没有任何import语句的情况下执行以下操作: myStdDrawObject.picture(); // if picture is non-static 要么 StdDraw.picture(); // if picture is static 另请注意,您不能对存在于默认包中的类使用静态导入。 You can't import non-static methods (only ...
  • 您可以使用java中的一个初始化方法代替main方法,例如此实例初始化程序: public class MyApp extends Application { { // here you can initialize hibernate and other stuff before the start method } public void start(Stage stage) { // ... your start met ...
  • 让它像以下一样静态: public static void main(String[] args) { try { writerof("file.txt", 6); } catch (IOException e) { e.printStackTrace(); } } public static void writerof(final String filePath, final int n) t ...
  • 使用JFreeCharts库。 有关更多信息,请参阅此示例: http : //www.tutorialspoint.com/jfreechart/jfreechart_bar_chart.htm Use the JFreeCharts library . Please see this example for more information: http://www.tutorialspoint.com/jfreechart/jfreechart_bar_chart.htm
  • 欢迎来到java :) 我尝试使用最简单的单词。 回答你的问题: 当您运行程序时,系统会调用main方法,因此您必须使用此名称(main),因为当您的应用程序启动时,有人默认调用方法main。 如果你选择另一个名字...你不能运行你的程序,因为当系统(我称之为系统,因为我认为你需要阅读一点)调用主方法,如果它找不到它你就无法启动你的程序。 试着想一想: 必须有人必须开始你的程序吗? 但它如何知道你的程序必须从哪里开始呢? 因此,java(还有其他语言)决定begin是方法main。 Welcome to j ...
  • assertTrue(true); 是一个毫无意义的无操作 删除对XFRCompiler.main(args);的调用周围的try / catch XFRCompiler.main(args); 因为所有这一切都是吞噬,并使调试更难; 很可能您会看到一个异常,告诉您问题所在。 在调用XFRCompiler.main(new String[]{"",""});之后应该调用fail() XFRCompiler.main(new String[]{"",""}); 因为你希望它抛出异常 将两个调用放在不同的测试方 ...
  • 错误:在StdDraw类中找不到主要方法 意味着1)它缺少一个main方法和2)你目前在eclipse设置中有项目来运行StdDraw类。 尝试右键单击左窗格中的Lineage类(或文件视图打开的位置)并选择“运行方式> Java应用程序”(不记得确切的内容) Error: Main method not found in class StdDraw Means 1) it's missing a main method and 2) you currently have the project in ec ...
  • 方法的位置不会改变方法的使用方式。 如果方法具有static修饰符,则不能在不使用类的构造函数作为指针的情况下将非静态方法调用到该方法中。 此外,因为您在另一个答案中提到,除非该变量也是静态的,否则无法将变量调用为静态方法,但同样可以使用构造函数指向该变量。 class MyClass { String s = "";//can't be used in a static method static String t = "";//can be used in a static method ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)