Joe Baldwin | 3 Feb 2012 20:35
Picon
Favicon

Odd error

I am manually mirroring a test app (successfully tested on my dev tomcat), onto a remote server.  I am getting
an odd error and am having trouble tracking it down. (an excerpt is listed below)
While it is possible that I have made a mistake in my coding, it is not likely since the associated code has
been working for a while.  I have also been fighting some tomcat caching problems, which I have resolved by
deleting the tomcat cache for this app each time I reload it.
I have tried standard debugging on my dev server, but the error is not showing up.  Also, it this error shows up
mostly when I am adding the parent to which it is referring, however, it also has just shown up at random when
I make a simple query via cayenne.
Is it possible that I have missed some configuration parameter in loading my cayenne map? It is acting so odd
that I am fairly convinced that this error message may not be pointing to the actual error.  
Totally confused. :)
Thanks,
Joe

com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or
update a child row: a foreign key constraint fails 

Erlend Birkenes | 3 Feb 2012 23:55

Memory usage of the shared cache

Hi

Is there a simple way to monitor or find out the memory usage of the shared
cache at runtime?

-Erlend
Tad | 4 Feb 2012 01:11
Picon
Gravatar

Modeling MySQL views and primary keys

We've got an existing MySQL 5.x database that contains a single view. This
view includes the primary key column of its source table in its results.

When modeling this view with a db-entity (through re-engineering,
migration, and manual creation) the modeler tells us that the entity lacks
a primary key column (even though the modeler picks up the column and adds
it as an attribute). So, we assign the appropriate PK column, and this
error disappears.

The problem now is that any future migrations attempt to alter the view and
add a primary key (using ALTER TABLE, no less), and we have to know not to
apply these changes to the database schema.

Is there a way to suppress this behavior? Perhaps by ignoring the view
entirely, or adding something to the view definition itself to assign the
"primary key" attribute to a column of its results?

Thanks for any help.

-Tad Fisher
Joe Baldwin | 4 Feb 2012 17:40
Picon
Favicon

Re: Odd error

Here is more research on my "odd error".  

Production Server Env
	Tomcat, linux, MySQL 5.1, Java 1.6
	I only have control of tomcat config files & start/stop operations
	**** I am using a *temp* configuration for installation and only have an IP which I aliased to "om28.com" in
my hosts file (a standard trick)

Symptoms & Research:
It appears that tomcat has logged a Cayenne configuration exception

	Caused by: org.apache.cayenne.ConfigurationException: [v.3.0.1 Aug 25 2010 19:42:04] Can't open
config file URL: jndi:/om28.com/store/WEB-INF/config/cayenne-files/cayenne.xml

Which seems to be accurate because that is not were I put the cayenne.xml file.  Here is my web.xml entry for
the app

	<!-- Cayenne ORM -->
	<context-param>
		<param-name>cayenne.configuration.path</param-name>
		<param-value>/WEB-INF/config/cayenne-files</param-value>
	</context-param>
	<filter>
		<filter-name>CayenneFilter</filter-name>
		<filter-class>org.apache.cayenne.conf.WebApplicationContextFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>CayenneFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
(Continue reading)

Andrus Adamchik | 5 Feb 2012 08:24
Favicon

Re: Modeling MySQL views and primary keys

AFAIK there's no way to tell the Modeler to ignore certain manual model tweaks when creating migrations.
Things like that are the reason why I am using manual SQL-based migrations to evolve my schema. 

Andrus

On Feb 4, 2012, at 3:11 AM, Tad wrote:

> We've got an existing MySQL 5.x database that contains a single view. This
> view includes the primary key column of its source table in its results.
> 
> When modeling this view with a db-entity (through re-engineering,
> migration, and manual creation) the modeler tells us that the entity lacks
> a primary key column (even though the modeler picks up the column and adds
> it as an attribute). So, we assign the appropriate PK column, and this
> error disappears.
> 
> The problem now is that any future migrations attempt to alter the view and
> add a primary key (using ALTER TABLE, no less), and we have to know not to
> apply these changes to the database schema.
> 
> Is there a way to suppress this behavior? Perhaps by ignoring the view
> entirely, or adding something to the view definition itself to assign the
> "primary key" attribute to a column of its results?
> 
> Thanks for any help.
> 
> -Tad Fisher

Andrus Adamchik | 5 Feb 2012 08:29
Favicon

Re: Odd error

While I don't know what the cause of the error is, my recommendation would be to put all Cayenne files in
CLASSPATH (e.g. WEB-INF/classes or in a jar under WEB-INF/lib). This is much more portable across any
Java environments.

Andrus

On Feb 4, 2012, at 7:40 PM, Joe Baldwin wrote:

> Here is more research on my "odd error".  
> 
> Production Server Env
> 	Tomcat, linux, MySQL 5.1, Java 1.6
> 	I only have control of tomcat config files & start/stop operations
> 	**** I am using a *temp* configuration for installation and only have an IP which I aliased to "om28.com"
in my hosts file (a standard trick)
> 
> Symptoms & Research:
> It appears that tomcat has logged a Cayenne configuration exception
> 
> 	Caused by: org.apache.cayenne.ConfigurationException: [v.3.0.1 Aug 25 2010 19:42:04] Can't open
config file URL: jndi:/om28.com/store/WEB-INF/config/cayenne-files/cayenne.xml
> 
> Which seems to be accurate because that is not were I put the cayenne.xml file.  Here is my web.xml entry for
the app
> 
> 	<!-- Cayenne ORM -->
> 	<context-param>
> 		<param-name>cayenne.configuration.path</param-name>
> 		<param-value>/WEB-INF/config/cayenne-files</param-value>
> 	</context-param>
(Continue reading)

Daniel Scheibe | 5 Feb 2012 12:11

Cayenne and transactions

Hi guys,

i'm trying to figure out how Cayenne is handling transactions in regards 
of when data is transferred to the database. I am trying to get some 
large transactions (many small records or a few very large records) 
working and so far haven't had luck. If i understand correcly, Cayenne 
is holding my records in a cache and when i execute the commitChanges() 
on the ObjectContext it starts to transfer all of the data to the 
database (isolated in a real database transaction). So my question is 
(and please correct me if my previuos assumption is wrong) how can I 
influence on this behaviour since i pretty much need Cayenne to use the 
database transaction more directly. When i skip Cayenne and issue SQL 
statements right through the JDBC connection (ie.g. BEGIN TRANSACTION, 
UPDATE, UPDATE, UPDATE..., COMMIT TRANSACTION) it works fine as with 
MySQL i'm only restricted to the maximum allowed size of the InnoDB 
transaction logfile which is quite sufficient for my purposes. On the 
other hand i completely understand that Cayenne would not know when i've 
finished working with an Entity as there is no kind of "save" command on 
the Entity itself.

Oh, this of course only goes for storing data inside the database, not 
for reading.

Maybe some of you guys with a bit more insight into the Cayenne 
internals can help me out on this or point me to the right direction.

Thanks in advance and a refreshing weekend!

Cheers,
Daniel
(Continue reading)

Aristedes Maniatis | 5 Feb 2012 13:28

Re: Cayenne and transactions

On 5/02/12 10:11 PM, Daniel Scheibe wrote:
> Hi guys,
>
> i'm trying to figure out how Cayenne is handling transactions in regards of when data is transferred to the
database. I am trying to get some large transactions (many small records or a few very large records)
working and so far haven't had luck. If i understand correcly, Cayenne is holding my records in a cache and
when i execute the commitChanges() on the ObjectContext it starts to transfer all of the data to the
database (isolated in a real database transaction). So my question is (and please correct me if my
previuos assumption is wrong) how can I influence on this behaviour since i pretty much need Cayenne to use
the database transaction more directly. When i skip Cayenne and issue SQL statements right through the
JDBC connection (ie.g. BEGIN TRANSACTION, UPDATE, UPDATE, UPDATE..., 
 COMMIT TRANSACTION) it works fine as with MySQL i'm only restricted to the maximum allowed size of the
InnoDB transaction logfile which is quite sufficient for my purposes. On the other hand
  i
> completely understand that Cayenne would not know when i've finished working with an Entity as there is no
kind of "save" command on the Entity itself.
>
> Oh, this of course only goes for storing data inside the database, not for reading.
>
> Maybe some of you guys with a bit more insight into the Cayenne internals can help me out on this or point me to
the right direction.
>
> Thanks in advance and a refreshing weekend!
>
> Cheers,
> Daniel

Can you explain a little more what you are trying to do and what problem you are trying to avoid. Yes, there are
ways to control the transactions through Cayenne (search this list for many previous thread discussing
this), but it sounds like you just need to commit your context at the appropriate places in your code.
(Continue reading)

Daniel Scheibe | 5 Feb 2012 21:26

Re: Cayenne and transactions

Thanks Ari,

i'm trying to store information about the content of archives (ZIP and 
RAR) inside a database table. They usually consist of a few hundred up 
to 20-30k thousand entries and i would like to keep this inside a 
transaction either suceeding or failing in a whole for a single archive. 
Of course i could issue commits in between and process them in chunks 
but its more work and harder to maintain the rollback of the process if 
something goes wrong or fails during the import phase. As previously 
mentioned i have it working with plain SQL statements but would love to 
integrate Cayenne in between to get the full advantage and convenience 
of an O/R mapper. Furthermore i'm using XADisk's support for 
transactions on the filesystem level to keep it synchronized with the 
database (also works out great with larger transactions).

Appreciating your help! I will search the list again, maybe i've missed 
some stuff that has been discussed already.

Cheers,
Daniel

Am 05.02.2012 13:28, schrieb Aristedes Maniatis:
> On 5/02/12 10:11 PM, Daniel Scheibe wrote:
>> Hi guys,
>>
>> i'm trying to figure out how Cayenne is handling transactions in
>> regards of when data is transferred to the database. I am trying to
>> get some large transactions (many small records or a few very large
>> records) working and so far haven't had luck. If i understand
>> correcly, Cayenne is holding my records in a cache and when i execute
(Continue reading)

Aristedes Maniatis | 5 Feb 2012 23:32

Re: Cayenne and transactions

On 6/02/12 7:26 AM, Daniel Scheibe wrote:
> Thanks Ari,
>
> i'm trying to store information about the content of archives (ZIP and RAR) inside a database table. They
usually consist of a few hundred up to 20-30k thousand entries and i would like to keep this inside a
transaction either suceeding or failing in a whole for a single archive. Of course i could issue commits in
between and process them in chunks but its more work and harder to maintain the rollback of the process if
something goes wrong or fails during the import phase. As previously mentioned i have it working with
plain SQL statements but would love to integrate Cayenne in between to get the full advantage and
convenience of an O/R mapper. Furthermore i'm using XADisk's support for transactions on the filesystem
level to keep it synchronized with the database (also works out great w
 ith larger transactions).
>
> Appreciating your help! I will search the list again, maybe i've missed some stuff that has been discussed already.
>
> Cheers,
> Daniel
>
> Am 05.02.2012 13:28, schrieb Aristedes Maniatis:
>> On 5/02/12 10:11 PM, Daniel Scheibe wrote:
>>> Hi guys,
>>>
>>> i'm trying to figure out how Cayenne is handling transactions in
>>> regards of when data is transferred to the database. I am trying to
>>> get some large transactions (many small records or a few very large
>>> records) working and so far haven't had luck. If i understand
>>> correcly, Cayenne is holding my records in a cache and when i execute
>>> the commitChanges() on the ObjectContext it starts to transfer all of
>>> the data to the database (isolated in a real database transaction). So
>>> my question is (and please correct me if my previuos assumption is
(Continue reading)


Gmane