Garf De Poes

Greenhorn
+ Follow
since Jun 05, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Garf De Poes

How do you combine XMLSchema validation with the use of DTD's (for entities)?

I have XMLSchema describing my XML instances. An instance is a combination of some parts. The parts can be used in multiple wholes.
So I thought to work in the following way :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE whole [
<!ENTITY p7 SYSTEM "p7.xml">
<!ENTITY p8 SYSTEM "p8.xml">
]>
<whole xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="mySchema.xsd">
&p7;
&p8;
</whole>

My Java code is :
SAXBuilder builder = new SAXBuilder(true);
builder.setFeature("http://apache.org/xml/features/validation/schema", true);
doc = builder.build(new File("PathToMyFile"));

Parsing the input file gives the following error : "Element type "whole" must be declared."

Anyone an idea what I'm doing wrong?
Hello,

I have a class with a map of maps that I want to persist.

public class Foo {
...
Map<PropertyType,Map<Date,String>> properties;
}

(A foo-object has some properties, which are unknown in advance and the history of the value of that property needs to be known/stored)

The idea is to store all properties in one table
Table PROPERTIES
Id <PK>
fooId <FK>
propertyId
Date
Value

To be able to define the hibernate-mapping I introduced a PropertyDTO which represents a row in the table.

Finally i introduced a getter/setter in Foo
public Set<PropertyDTO> getProperties() which creates a list based on the properties-map. (There is no Set instance-field)
(The setters fills the properties-map)

The problem is that when I persist a foo-object every propertyDTO is put TWICE in the table. When I create Set instance-field (and by consequence duplicate the properties in every foo-object), persisting the object works fine...

Can I avoid the duplicate insertion?