Euhm, hang on. So you have a foreign key from column containerId to
the table that backs to Container class. However, you're here working
with RepositoryContainer tables and inserting into that. Is this
correct? Are you sure you're working with the correct entities?
On 15 Aug 2007, at 15:07, Jeremy Whitlock wrote:
>
> Geert,
> Here is all of the executed SQL (obfuscated):
>
> Aug 15, 2007 7:00:11 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 1ms : CREATE SEQUENCE SEQ_repositorycontainer
> Aug 15, 2007 7:00:11 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 111ms : CREATE TABLE repositorycontainer (active CHAR(1) NOT
> NULL, authzPath LONGVARCHAR NOT NULL, created TIMESTAMP NOT NULL,
> description VARCHAR(256) NOT NULL, displayName VARCHAR(64) NOT NULL,
> id INTEGER NOT NULL, path LONGVARCHAR NOT NULL, serverType VARCHAR(8)
> NOT NULL, PRIMARY KEY (id), UNIQUE (id), CHECK (active != ''), CHECK
> (authzPath != ''), CHECK (description != ''), CHECK (displayName !=
> ''), CHECK (path != ''), CHECK (serverType != ''), CHECK (serverType
> IN ('Apache','Serve')))
> Aug 15, 2007 7:00:11 AM
> org.thoughtspark.sac.elements.ApplicationInitializer$Deployer install
> INFO: Table created for RepositoryContainer
> Aug 15, 2007 7:00:11 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 0ms : CREATE SEQUENCE SEQ_repository
> Aug 15, 2007 7:00:11 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 29ms : CREATE TABLE repository (active CHAR(1) NOT NULL,
> containerId INTEGER NOT NULL, created TIMESTAMP NOT NULL, dataStore
> VARCHAR(4) NOT NULL, description VARCHAR(256) NOT NULL, displayName
> VARCHAR(64) NOT NULL, id INTEGER NOT NULL, name VARCHAR(64) NOT NULL,
> PRIMARY KEY (id), FOREIGN KEY (containerId) REFERENCES
> repositorycontainer (id), UNIQUE (id), CHECK (active != ''), CHECK
> (containerId != 0), CHECK (dataStore != ''), CHECK (dataStore IN
> ('BDB','FSFS')), CHECK (description != ''), CHECK (displayName != ''),
> CHECK (name != ''))
> Aug 15, 2007 7:00:11 AM
> org.thoughtspark.sac.elements.ApplicationInitializer$Deployer install
> INFO: Table created for Repository
> Aug 15, 2007 7:01:24 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 36ms : SELECT * FROM Repository WHERE active = 'Y' ORDER BY
> displayName ASC
> Aug 15, 2007 7:01:24 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 2ms : SELECT * FROM RepositoryContainer WHERE active = 'Y' ORDER
> BY displayName ASC
> Aug 15, 2007 7:01:35 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 0ms : SELECT * FROM RepositoryContainer WHERE active = 'Y' ORDER
> BY displayName ASC
> Aug 15, 2007 7:02:18 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 12ms : SELECT count(*) FROM repositorycontainer WHERE id = -1
> Aug 15, 2007 7:02:18 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 0ms : SELECT count(*) FROM repositorycontainer WHERE displayName
> = 'Production Container' AND active = 'Y'
> Aug 15, 2007 7:02:18 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 0ms : SELECT count(*) FROM repositorycontainer WHERE path =
> '/Users/jwhitlock/dev/java/sac/web-app/target/repos' AND active = 'Y'
> Aug 15, 2007 7:02:18 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 0ms : CALL NEXT VALUE FOR SEQ_repositorycontainer
> Aug 15, 2007 7:02:18 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 103ms : INSERT INTO repositorycontainer (active, authzPath,
> created, description, displayName, id, path, serverType) VALUES (?, ?,
> ?, ?, ?, ?, ?, ?)
> Aug 15, 2007 7:02:19 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 0ms : SELECT * FROM RepositoryContainer WHERE active = 'Y' ORDER
> BY displayName ASC
> Aug 15, 2007 7:02:23 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 0ms : SELECT * FROM Repository WHERE active = 'Y' ORDER BY
> displayName ASC
> Aug 15, 2007 7:02:23 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 4ms : SELECT * FROM RepositoryContainer WHERE active = 'Y' ORDER
> BY displayName ASC
> Aug 15, 2007 7:02:41 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 1ms : SELECT count(*) FROM repository WHERE id = -1
> Aug 15, 2007 7:02:41 AM com.uwyn.rife.database.DbStatement outputTrace
> INFO: 1ms : SELECT * FROM repositorycontainer WHERE id = 0
>
> The above is me successfully creating a RepositoryContainer object
> with the id of 0 and then trying to create a Repository that has a
> containerId of 0.
>
> Take care,
>
> Jeremy
>
> On 8/15/07, Geert Bevin <[EMAIL PROTECTED]> wrote:
>>
>> Hi Jeremy,
>>
>> can you please turn on SQL tracing to see which query is actually
>> executed to perform the validation?
>>
>> You can do this by setting the config parameter SQL_DEBUG_TRACE to
>> true.
>>
>> Thanks,
>>
>> Geert
>>
>> On 15 Aug 2007, at 04:18, Jeremy Whitlock wrote:
>>
>>>
>>> Hi All,
>>> I have a simple database configuration that looks like so:
>>>
>>> Repository
>>> ----------------
>>> ID (PK)
>>> CONTAINERID (FK)
>>> .....
>>>
>>> Container
>>> --------------
>>> ID (PK)
>>> .....
>>>
>>> In my RepositoryMetaData.java, I have the following constraint:
>>>
>>> .....
>>> addConstraint(new ConstrainedProperty("containerId")
>>> .notEmpty(true)
>>> .notNull(true)
>>> .manyToOne(Container.class, "id")
>>> );
>>> .....
>>>
>>> RIFE creates my tables as expected from the MetaData classes but
>>> when
>>> I try to validate a Repository bean, I get a ValidationError when I
>>> shouldn't. The Repository.getContainerId() returns an id of an
>>> existing container but when I do:
>>>
>>> ((Validated)repository).validate(Utils.getGenericQueryManager
>>> (Repository.class))
>>>
>>> I get the following (error is a ValidationError):
>>>
>>> error.getSubject() = INVALID
>>> error.getIdentifier() = containerId
>>> error.getErroneousValue() = null
>>>
>>> Now...I know that there is a valid containerId set in my Repository
>>> bean but RIFE continues to tell me that the containerId is invalid.
>>> If my understanding is correct, if I have a Container row with an id
>>> of 0 and my Repository bean has a containerId of 0, it should be
>>> valid. Can someone see some error in my logic? All I want to do is
>>> store the id of a Container object in my Repository object and
>>> validate properly. Based on my POJOs and the MetaData for the
>>> POJOs,
>>> I do not see where I'm going wrong.
>>>
>>> Thanks in advance,
>>>
>>> Jeremy
>>>
>>>>
>>
>> --
>> Geert Bevin
>> Terracotta - http://www.terracotta.org
>> Uwyn "Use what you need" - http://uwyn.com
>> RIFE Java application framework - http://rifers.org
>> Music and words - http://gbevin.com
>>
>>
>>>
>>
>
> >
--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"rife-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---