composite

Hibernate criteria problem with composite key

£可爱£侵袭症+ 提交于 2019-12-06 04:49:34
问题 I got this hibernate mapping: <class name="CoverageTerm" table="coverage_term"> <composite-id name="id" class="CoverageTermPK"> <key-many-to-one name="productTerm" class="ProductTerm"> <column name="termtype_id"></column> <column name="product_id" ></column> </key-many-to-one> <key-many-to-one name="productCoverage" class="ProductCoverage" column="product_coverage_id"></key-many-to-one> </composite-id> <property name="data"/> </class> This is a simple composite key mapping with a relation to

WPF databinding to composite class patterns?

点点圈 提交于 2019-12-06 03:52:23
问题 I am trying out WPF for the first time and I am struggling with how to bind controls to a class that is built up using composition of other objects. For example, If I have class Comp that is built up of two separate classes (note various elements left out for clarity): class One { int _first; int _second; } class Two { string _third; string _fourth; } class Comp { int _int1; One _part1; Two _part2; } Now I understand that I can easily bind _int1 using a "get" defined in Comp. But how do I

Select from PostgreSQL function that returns composite type

你。 提交于 2019-12-06 01:16:04
How to include a function that returns a composite type in a SELECT ? I have composite type: CREATE TYPE public.dm_nameid AS ( id public.dm_int, name public.dm_str ); Also, I have a function that returns this type fn_GetLinkedProject(integer) . And I need to make something like this: SELECT p.id, p.data, p.name, pl.id linked_id, pl.name linked_name FROM tb_projects p left join "fn_GetLinkedProject"(p.id) pl How can I do this? I have read this article. I don't want following method: SELECT p.id, p.data, p.name, (select pl1.id from "fn_GetLinkedProject"(p.id) pl1 ) linked_id, (select pl2.name

How do I make it possible to resize a composite by dragging the corner

爱⌒轻易说出口 提交于 2019-12-04 19:03:14
I am working with SWT and I would like to be able to resize a composite by dragging the corner of it, the same way that you can resize a shell. I'm sure someone out there has implemented a good solution. Thanks. I think what you are looking for can be implemented with org.eclipse.swt.widgets.Tracker here is sample working code: public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.open(); final Composite b = new Composite(shell, SWT.NONE); b.setBounds(20, 20, 80, 80); b.setBackground(display.getSystemColor(SWT.COLOR_BLUE)); b

Hibernate criteria problem with composite key

陌路散爱 提交于 2019-12-04 10:44:18
I got this hibernate mapping: <class name="CoverageTerm" table="coverage_term"> <composite-id name="id" class="CoverageTermPK"> <key-many-to-one name="productTerm" class="ProductTerm"> <column name="termtype_id"></column> <column name="product_id" ></column> </key-many-to-one> <key-many-to-one name="productCoverage" class="ProductCoverage" column="product_coverage_id"></key-many-to-one> </composite-id> <property name="data"/> </class> This is a simple composite key mapping with a relation to table productCoverage and a composite key relation to productterm. Now the problem comes in my search

Grails Domain Class without ID field or with partially NULL composite field

随声附和 提交于 2019-12-04 09:56:11
Per an answer to a previous question (answer here: SQL/Database Views in Grails ), I have tried to use a domain class to represent a view in my database. This works wonderfully in most cases, however: I have a view with no single unique key. Let's say the underlying tables look like this: A: id,varX 1,"Blah" 2,"Foo" 3,"Bar" B: id,A.id,C.id 1,2,1 2,2,2 3,3,1 C: id,varY 1,"Boom" 2,"Fizzle" My view looks like this: A.id,varX,B.id,C.id,varY 1,"Blah",NULL,NULL,NULL 2,"Foo",1,1,"Boom" 2,"Foo",2,2,"Fizzle" 3,"Bar",3,1,"Boom" That is exactly how it ought to look for our purposes. However, as you can

how can i insert a composite component (menu of menus) in my database

半城伤御伤魂 提交于 2019-12-04 07:00:57
问题 I am implementing the Composite Design pattern and I need to insert a menu in the database but the menu may consist of other menus and menu items so when I tried to insert them recursively, I got an error because the submenu and sub items need to know the parent ID which isn't created yet. public boolean insertMenu(Menu menu) { try { PreparedStatement statement = connection.prepareStatement("INSERT INTO `menu` VALUES (NULL, ?, ?, ?)"); statement.setString(1, menu.getName()); statement.setDate

MySQL composite indexes and operator BETWEEN

两盒软妹~` 提交于 2019-12-04 06:09:02
I have a question about this query: SELECT * FROM runs WHERE (NOW() BETWEEN began_at AND finished_at) Do you think it makes sense to create composite index for began_at and finished_at columns? Or it makes sense to create index only for began_at? Your style is very uncommon. Most people would probably write WHERE began_at < NOW() AND finished_at > NOW() However. I would recommend putting an index on both fields. A combined key wont be of use to you because you it would only speed up searcher for specific date combinations. Well this is not entirely true because if you use betree a combined key

composite inheritance: how to assign a final field at sub-class constructor which depends on 'this' value (backward reference)?

时间秒杀一切 提交于 2019-12-04 05:31:47
问题 I use composite classes to group functionalities. But, the class A (with composite A1), got inherited by B (with composite B1), and a behavior existent at A1 is going to be adapted at B1, but the final a1 must be a B1 instance for this to work. Obs.: I have ways to make sure the composite instantiation happens properly (only by its composite partner). Unable to assign a B1 object to a1 final field: class finalFieldTestFails{ class A1{ A1(A a){} } class A{ protected final A1 a1; A(){ this.a1 =

Iterating hierarchy of nodes - Visitor and Composite?

寵の児 提交于 2019-12-04 05:04:58
Let's imagine I have a collection of nodes that I use for my Renderer class later on. Then I have a Visitor class that can visit node or whole collection. It's simple because my collection of nodes it's simply a wrapper to the std::list with few extra methods. The problem is I'd like to have a tree like structure for nodes(instead of simple list) so a node can have a parent and n children. That would be handy as I'd like to be able to pass to my Renderer a node and render everything "below" that node. The answer probably is Composite. How can I use together Visitor and Composite? I've read