Bugs item #890507, was opened at 2004-02-04 16:52
Message generated for change (Comment added) made by rafciom
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=890507&group_id=22866
Category: JBossCMP
Group: v3.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Rafal Kedziorski (rafciom)
Assigned to: Alexey Loubyansky (loubyansky)
Summary: page-size problem
Initial Comment:
Hi,
I found a new problem in JBossCMP. This is our entity bean:
package net.magix.ejb.media.entitybeans;
import javax.ejb.CreateException;
import javax.ejb.EntityBean;
import net.magix.ejb.entitybeans.AbstractEntityBean;
/**
* Description of the Class
*
* @author Rafal Kedziorski
* @version $Id: Media_2_AlbumBean.java,v 1.11
2004/01/08 10:14:42 rafal Exp $
* @ejb.bean
* name = "Media_2_AlbumBean"
* description = "Media_2_AlbumBean Entity Bean"
* display-name = "Media_2_AlbumBean Entity Bean"
* local-jndi-name = "media/Media_2_AlbumBean"
* view-type = "local"
* type = "CMP"
* cmp-version = "2.x"
* schema = "media_2_album"
* primkey-field = "media_2_album_id"
*
* @ejb.finder
* view-type = "local"
* signature = "java.util.Collection
findAllByAlbumId(java.lang.Long album_id)"
* query = "SELECT OBJECT(o) FROM media_2_album o
WHERE o.album_id = ?1"
* result-type-mapping = "Local"
*
* @ejb.finder
* view-type = "local"
* signature =
"net.magix.ejb.media.entitybeans.Media_2_AlbumLocalHome
findByMediaId(java.lang.Long media_id)"
* query = "SELECT OBJECT(o) FROM media_2_album o
WHERE o.media_id = ?1"
* result-type-mapping = "Local"
*
* @ejb.security-identity
* use-caller-identity = "true"
*
* @ejb.transaction
* type = "Mandatory"
*
* @jboss.persistence
* row-locking = "true"
* list-cache-max = "10000"
*
* @ejb.persistence
* table-name = "media_2_album"
*
* @jboss.container-configuration
* name = "Standard CMP 2.x EntityBean with
Commit Option C"
*
* @jboss.read-ahead
* strategy = "on-load"
* page-size = "4"
* eager-load-group = "*"
*
* @jboss.entity-command
* name = "mysql-get-generated-keys"
*
*/
public abstract class Media_2_AlbumBean extends
AbstractEntityBean implements EntityBean {
/**
* Gets the media_2_album_id attribute of the
Media_2_AlbumBean object
*
* @return The media_2_album_id value
* @ejb.pk-field
*
* @ejb.persistence
* column-name = "media_2_album_id"
* sql-type = "media_2_album_id"
*
* @jboss.persistence
* auto-increment = "true"
*
* @jboss.method-attributes
* read-only = "false"
*
* @ejb.interface-method
* view-type = "local"
*
*/
public abstract Long getMedia_2_album_id();
/**
* Sets the media_2_album_id attribute of the
Media_2_AlbumBean object
*
* @param media_2_album_id The new
media_2_album_id value
*/
public abstract void setMedia_2_album_id(Long
media_2_album_id);
/**
* Gets the media_id attribute of the
Media_2_AlbumBean object
*
* @return The folder_id value
* @ejb.persistence
* column-name = "media_id"
* sql-type = "media_id"
*
* @jboss.method-attributes
* read-only = "false"
*
* @ejb.interface-method
* view-type = "local"
*
*/
public abstract Long getMedia_id();
/**
* Sets the media_id attribute of the
Media_2_AlbumBean object
*
* @param media_id The new media_id value
* @ejb.transaction
* type = "Mandatory"
*
* @ejb.interface-method
* view-type = "local"
*
*/
public abstract void setMedia_id(Long media_id);
/**
* Gets the album_id attribute of the
Media_2_AlbumBean object
*
* @return The album_id value
* @ejb.persistence
* column-name = "album_id"
* sql-type = "album_id"
*
* @jboss.method-attributes
* read-only = "false"
*
* @ejb.interface-method
* view-type = "local"
*
*/
public abstract Long getAlbum_id();
/**
* Sets the album_id attribute of the
Media_2_AlbumBean object
*
* @param album_id The new album_id value
* @ejb.transaction
* type = "Mandatory"
*
* @ejb.interface-method
* view-type = "local"
*
*/
public abstract void setAlbum_id(Long album_id);
/**
* Gets the position attribute of the
Media_2_AlbumBean object
*
* @return The description value
* @ejb.persistence
* column-name = "position"
* sql-type = "position"
*
* @jboss.method-attributes
* read-only = "false"
*
* @ejb.interface-method
* view-type = "local"
*
*/
public abstract Integer getPosition();
/**
* Sets the position attribute of the
Media_2_AlbumBean object
*
* @param position The new position value
* @ejb.transaction
* type = "Mandatory"
*
* @ejb.interface-method
* view-type = "local"
*
*/
public abstract void setPosition(Integer position);
/**
* Description of the Method
*
* @param media_id Description of the
Parameter
* @param album_id Description of the
Parameter
* @param position Description of the
Parameter
* @return Description of the
Return Value
* @exception CreateException Description of the
Exception
* @ejb.create-method
*
*/
public Long ejbCreate(Long media_id, Long album_id,
Integer position)
throws CreateException {
if (logger.isDebugEnabled()) {
logger.debug("Media_2_AlbumBean('" +
media_id + "', '" + album_id + "', '" + position + "')
entered");
}
setMedia_id(media_id);
setAlbum_id(album_id);
setPosition(position);
return null;
}
/**
* Description of the Method
*
* @param media_id Description of the
Parameter
* @param album_id Description of the
Parameter
* @param position Description of the
Parameter
* @exception CreateException Description of the
Exception
*/
public void ejbPostCreate(Long media_id, Long
album_id, Integer position)
throws CreateException { }
}
With page-size = "4" it's not working with the actual
version from CVS. In JBoss 3.2.2 it works correctly.
After change page-size="1" it's working with JBoss
3.2.4RC1.
We have much problems with JBossCMP in 3.2.4RC1. When
will be all the JBossCMP bugs fixed? Are there efforts
to fix it in the next time?
Best Regards,
Rafal
----------------------------------------------------------------------
>Comment By: Rafal Kedziorski (rafciom)
Date: 2004-02-04 22:11
Message:
Logged In: YES
user_id=201737
Submit the simplest testcase possible that demonstrates the
problem
----------------------------------------------------------------------
Comment By: Rafal Kedziorski (rafciom)
Date: 2004-02-04 22:11
Message:
Logged In: YES
user_id=201737
I did the same test on JBoss 3.2.4RC1 and JBoss 3.2.2. See
the attached txt file.
Best Regards,
Rafal
----------------------------------------------------------------------
Comment By: Rafal Kedziorski (rafciom)
Date: 2004-02-04 21:25
Message:
Logged In: YES
user_id=201737
I try to describe what happens for page-size = "4":
we have more than 4 instances of the entity bean, i.e. 10.
for each instance we want change the position with this code:
// get all media_2_album and set position
try {
Collection m2aCol =
media2AlbumHome.findAllByAlbumId(album_id);
int m2aColSize = m2aCol.size();
Iterator m2aColIte = m2aCol.iterator();
for (int i = 0; i < m2aColSize; i++) {
Media_2_AlbumBeanLocal m2aLocal =
(Media_2_AlbumBeanLocal) m2aColIte.next();
Long media_id = m2aLocal.getMedia_id();
Integer oldPosition = m2aLocal.getPosition();
// get new Position
Integer newPosition = (Integer)
mediaPositionMap.get(media_id);
if (newPosition == null) {
sessionContext.setRollbackOnly();
logger.error("setNewMediaPositionForAlbum() failed because
media " + media_id + " from album " + album_id + " is not in
new position map");
throw new
OMAException("MediaBean::setNewMediaPositionForAlbum()
failed because media " + media_id + " from album " +
album_id + " is not in new position map",
ErrorIDs.PARAMETER_ERROR);
}
if (logger.isDebugEnabled()) {
logger.debug("setNewMediaPositionForAlbum() [i/max=" + i +
"/" + m2aColSize + ", oldPosition=" + oldPosition + ",
newPosition=" + newPosition + ", media_id=" + media_id + ",
media_2_album_id=" + m2aLocal.getMedia_2_album_id() + "]");
}
// check if media is on new position
if (! oldPosition.equals(newPosition)) {
m2aLocal.setPosition(newPosition);
}
// remove media from map
mediaPositionMap.remove(media_id);
}
// check if mediaPositionMap is empty
if (! mediaPositionMap.isEmpty()) {
sessionContext.setRollbackOnly();
logger.error("setNewMediaPositionForAlbum()
failed in mediaPositionMap are " + mediaPositionMap.size() +
" more media than in album " + album_id);
throw new
OMAException("MediaBean::setNewMediaPositionForAlbum()
failed in mediaPositionMap are " + mediaPositionMap.size() +
" more media than in album " + album_id,
ErrorIDs.PARAMETER_ERROR);
}
}
catch (FinderException fe) {
sessionContext.setRollbackOnly();
logger.fatal("setNewMediaPositionForAlbum()
failed with FinderException", fe);
throw new
OMAException("MediaBean::setNewMediaPositionForAlbum()
failed with FinderException", ErrorIDs.FATAL_ERROR);
}
our loop will be called 10 times, but we see in the database
logfile max. 4 update statements if this statement
// check if media is on new position
if (! oldPosition.equals(newPosition)) {
m2aLocal.setPosition(newPosition);
}
is true. it look, like JBoss is ignoring other instances
over 4th "place".
Regards,
Rafal
----------------------------------------------------------------------
Comment By: Alexey Loubyansky (loubyansky)
Date: 2004-02-04 20:55
Message:
Logged In: YES
user_id=543482
What exactly is not working?
I can't understand the second comments about updates. But I
fixed one update related bug, i.e. when an instance was
loaded from read-ahead cache it wasn't considered modified
at commit. Maybe, that's what you see.
----------------------------------------------------------------------
Comment By: Rafal Kedziorski (rafciom)
Date: 2004-02-04 17:17
Message:
Logged In: YES
user_id=201737
Hi,
I forgot to write, that we change some entity beans (the
position in the bean above) in one transaction and JBoss
send only one update to the db. But JBoss send only a few
update queries.
Regards,
Rafal
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=890507&group_id=22866
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development