[JBoss Tools (users)] - Re: How to generate annotated Java classes from hbm.xml file
by baz
Finally i found it.
This mapping causes the exception:
<?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
| <hibernate-mapping package="demo">
| <class name="Sample2Well" table="sample2well" optimistic-lock="none">
| <id name="id" type="long" unsaved-value="null" column="SAMPLE2WELLID">
| <generator class="native"/>
| </id>
| <property name="analysisIndex" type="integer" column="analysisindex"/>
| <bag name="sampleWell" lazy="false" table="samplewell" cascade="save-update">
| <key foreign-key="sampleWell_id" column="SAMPLE2WELLID"/>
| <composite-element class="demo.SampleWellType">
| <many-to-one name="sample" entity-name="demo.Sample" foreign-key="Sample_id" not-null="false" column="SAMPLEID" cascade="none"/>
| <nested-composite-element name="well" class="demo.Well">
| <property name="adress" type="string" column="well_adress"/>
| <property name="column" type="short" column="well_column"/>
| <property name="row" type="character" column="well_row" length="1"/>
| </nested-composite-element>
| </composite-element>
| </bag>
| </class>
| </hibernate-mapping>
| <hibernate-mapping package="demo">
| <class name="Sample" table="sample" optimistic-lock="none">
| <meta attribute="class-description" inherit="false">@hibernate.class table="sample"</meta>
| <id name="id" type="long" unsaved-value="null" column="SAMPLEID">
| <generator class="native"/>
| </id>
| <version name="version" column="version"/>
| <property name="sampleCode" type="string" column="sample_code"/>
| </class>
| </hibernate-mapping>
|
I have created this second jira issue:
http://jira.jboss.com/jira/browse/JBIDE-1768
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128158#4128158
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128158
18 years, 2 months
[JBoss Seam] - Event not raised with annotations - Bug?
by ruettimac
Hi,
I have two methods raising an event - one raises the event, the other not. If I raise the event programmatically it works, but not while I am annotating the raise of the event.
First the method which does not raise the event with annotations:
| @RaiseEvent(value=SeamConstants.EVENT_SPORTEQUIPMENT_CHANGED)
| public String deleteSportEquipment(final SportEquipment pSportEquipment) throws PersistencyException {
| Validate.notNull(pSportEquipment, "Argument pSportEquipment is mandatory");
|
| try {
| SportEquipment toDelete = mEntityManager.merge(pSportEquipment);
| pSportEquipment.getCustomer().getSportEquipments().remove(pSportEquipment);
| mEntityManager.remove(toDelete);
| } catch (final Exception pException) {
| mLog.error("Failed to delete sport equipment #0 of customer #1", pException, pSportEquipment.getName(), pSportEquipment.getCustomer().
| getLogin().
| getSynonym());
| throw new PersistencyBackendException("exception.persistencybackend", pException);
| } finally {
| //Events.instance().raiseEvent(SeamConstants.EVENT_SPORTEQUIPMENT_CHANGED);
| }
|
| return NavigationConstants.REDISPLAY;
| }
|
The constant NavigationConstants.REDISPLAY simply returns null.
The second method which raises the event with annotations:
@RaiseEvent(value=SeamConstants.EVENT_SPORTEQUIPMENT_CHANGED)
| public String persistSportEquipment(final SportEquipment pSportEquipment) throws PersistencyException {
| Validate.notNull(pSportEquipment, "Argument pSportEquipment is mandatory");
|
| SportEquipment sportEquipment = null;
|
| // update first if id already set, if id is null we have a fresh sport equipment
| if (null != pSportEquipment.getId()) {
| sportEquipment = mEntityManager.merge(pSportEquipment);
| } else {
| sportEquipment = pSportEquipment;
| sportEquipment.getCustomer().getSportEquipments().add(sportEquipment);
| }
|
| try {
| mEntityManager.persist(sportEquipment);
| } catch (final Exception pException) {
| mLog.error("Failed to save changed for sport equipment #0 of customer #1", pException, pSportEquipment.getName(), pSportEquipment.getCustomer().
| getLogin().
| getSynonym());
| throw new PersistencyBackendException("exception.persistencybackend", pException);
| } finally {
| //Events.instance().raiseEvent(SeamConstants.EVENT_SPORTEQUIPMENT_CHANGED);
| }
|
| return NavigationConstants.SUCCESS;
| }
While looking at the code; Do you see anything that is wrong? The only difference I see is the return value. I validated, that if null is returned, the event is not fired. But If I return a value, the event is fired.
I suppose this is a bug?!
Regards,
Cyrill
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128153#4128153
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128153
18 years, 2 months
[Remoting] - Re: Concurrency Issue (ClassCastException) in MicroRemoteCli
by ron.sigal@jboss.com
Hi Paul,
I've been thinking about this issue some more.
1. Definitely, setting the unmarshaller instance variable (if there is to be such a thing) should have been synchronized.
2. I've been re-reading the documentation on the Application Server classloading structure, particularly sections "3.2.2.4. Inside the JBoss Class Loading Architecture" - http://labs.jboss.com/file-access/default/members/jbossas/freezone/docs/S...
and "3.5.1. Deployers and ClassLoaders" - http://labs.jboss.com/file-access/default/members/jbossas/freezone/docs/S....
It seems to me that, in the usual case, having the same jar in two different ears shouldn't be a problem, since classloading for both ears would be delegated to the same parent classloader, which is, in fact, the same classloader that loads the Remoting classes.
I say "the usual case" because it's possible to configure an ear to use its own classloader. Does your application do that?
If not, I'm wondering if the problem can be fixed
1. with the synchronization block around the unmarshaller creation code, and
2. without eliminating the call to setUnMarshaller(unmarshaller).
If you have a chance, could you try that?
Meanwhile, I will try to get some insight from someone in the Application Server group.
-Ron
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128152#4128152
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128152
18 years, 2 months
[Persistence, JBoss/CMP, Hibernate, Database] - Schema generated via Hibernate, sequence issue?
by hubaghdadi
Hi.
I got my database schema generated for PostgreSQL database via Hibernate annotations.
The schema generated tables definitions and one sequence definition called: hibernate_sequence
I wrote a couple of SQL text files to populate the database, I run those files via Apache Ant.
| insert into books values (1, '...', '...', '...');
| insert into books values (2, '...', '...', '...');
| insert into categories values (1, '...', '...', '...');
| insert into categories values (2, '...', '...', '...');
|
I start to smell some kind of disaster...
I shouldn't hard code IDs by hand as I did, I have to use hibernate_sequence to populate all IDs in all tables, right?
If it is so, any ideas how to do it with my SQL files and Ant?
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128151#4128151
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128151
18 years, 2 months