具有多个字段的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
最满意答案
错误:在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)
相关问答
更多-
为什么我不能在main类的main方法之外创建另一个方法?(why can't I create another method aside from main method in main class?)[2022-04-05]
我想你使用这样的代码。 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 ...
-
为什么导入在Java中失败?(Why did my import fail in Java?)[2023-05-12]
你不能导入非静态方法(只有类和静态成员),而你不必! 如果你的两个类都存在于默认包中,那么你应该能够在没有任何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 ...
-
调用main方法(Calling in the main method)[2022-06-14]
让它像以下一样静态: 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
-
主要方法是什么?(What is the main method? [duplicate])[2024-01-06]
欢迎来到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主要方法?(StdDraw main method?)[2022-06-26]
错误:在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 ...