code-generation

How to generate DELETE statements in PL/SQL, based on the tables FK relations?

自古美人都是妖i 提交于 2019-11-27 14:10:18
问题 Is it possible via script/tool to generate authomatically many delete statements based on the tables fk relations, using Oracle PL/SQL? In example: I have the table: CHICKEN (CHICKEN_CODE NUMBER) and there are 30 tables with fk references to its CHICKEN_CODE that I need to delete; there are also other 150 tables foreign-key-linked to that 30 tables that I need to delete first. Is there some tool/script PL/SQL that I can run in order to generate all the necessary delete statements based on the

How can I extend Java code generated by JAXB, CXF or Hibernate tools?

时光毁灭记忆、已成空白 提交于 2019-11-27 13:00:10
问题 With generated Java source code, like code generated with Hibernate tools code generated with JAXB schema binding (xjc) code generated with WDSL2Java (cxf) all generated classes are "value object" types, without business logic. And if I add methods to the generated source code, I will loose these methods if I repeat the source code generation. Do these Java code generation tools offer ways to "extend" the generated code? For example, to override the ToString method (for logging) to implement

Change unhandled exception auto-generated catch code in Eclipse?

谁都会走 提交于 2019-11-27 12:48:28
问题 If I have unhandled exception in Java, Eclipse proposes two options to me: (1) add throws declaration and (2) surround with try/catch. If I choose (2) it adds a code try { myfunction(); } catch (MyUnhandledException e) { // TODO Auto-generated catch block e.printStackTrace(); } I want to change this to try { myfunction(); } catch (MyUnhandledException e) { throw new RuntimeException(e); } Is this possible? UPDATE Why are so love to change the topic people??? If exception is catched and

Code replacement with an annotation processor

半世苍凉 提交于 2019-11-27 11:42:52
I'm trying to write an annotation processor to insert methods and fields on a class... and the documentation is so sparse. I'm not getting far and I don't know if I'm approaching it correctly. The processing environment provides a Filer object which has handy methods for creating new source and class files. Those work fine but then I tried to figure out how read the existing source files, and all it provides is "getResource". So in my Processor implementation I've done this: @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { try { for

'CompanyName.Foo' is a 'namespace' but is used like a 'type'

浪子不回头ぞ 提交于 2019-11-27 11:12:49
Restatement of the question I'm resurrecting this question because I just ran into this error again today, and I'm still utterly confused why the C# compiler bothers to check for collisions between namespaces and types in contexts where it makes no sense for a namespace to exist. If I have... public Foo MyFoo { get; set; } ...why would the compiler care that Foo is both a namespace and a type? Can you declare a property as a namespace instead of a type? What is the logic behind the "namespace used like type" compiler error? What problem is this saving me from? [And how do I tag Eric Lippert? :

How to view “generated HTML code” in Firefox?

岁酱吖の 提交于 2019-11-27 11:09:15
问题 If using Firebug, we can click on the HTML tab, and click to expand each element to see the generated HTML code. Is there a way to expand it all or get a plain text file? I just accidentally found out that there doesn't even need to be Firebug. We can just press CTRL-A (to select all) on the webpage, and then right click and choose "View Selection Source", then we will get a plain text file of the "current HTML code", even will see a <div> that is the Firebug panel that is before the <body>

Java code generation [closed]

蓝咒 提交于 2019-11-27 11:04:05
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . What are the leading frameworks for java code generation? I am not looking for a DB or app generation tool. I have a skeleton of a

Naming Conventions For Partial Class Files

喜欢而已 提交于 2019-11-27 10:46:28
I'm generating the bulk of my ASP.NET MVC scaffolding code. All generated files are partial classes which use standard naming conventions. For example, my employee controller file is named EmployeeController.cs. If I wish to extend the EmployeeController with custom, non-generated logic, I create a second partial class file named EmployeeControllerCustom.cs. I separate the custom and generated logic into two different files so the next time I generate the EmployeeController my custom changes aren't overwritten. Adding the "Custom" suffix to the file name seems reasonable to me, but is there a

Can I define properties in partial classes, then mark them with attributes in another partial class?

天大地大妈咪最大 提交于 2019-11-27 10:43:29
Is there a way I can have a generated code file like so: public partial class A { public string a {get; set;} } and then in another file: public partial class A { [Attribute("etc")] public string a {get; set;} } So that I can have a class generated from the database and then use a non-generated file to mark it up? Dan Dumitru I've seen something like this done in an article by Scott Guthrie (near the end of it) - didn't try it myself, though. http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx [MetadataType(typeof(Person_Validation))] public partial class

How can I generate database tables from C# classes?

眉间皱痕 提交于 2019-11-27 10:23:40
Does anyone know a way to auto-generate database tables for a given class? I'm not looking for an entire persistence layer - I already have a data access solution I'm using, but I suddenly have to store a lot of information from a large number of classes and I really don't want to have to create all these tables by hand. For example, given the following class: class Foo { private string property1; public string Property1 { get { return property1; } set { property1 = value; } } private int property2; public int Property2 { get { return property2; } set { property2 = value; } } } I'd expect the