[JBoss Seam] - @OneToMany Question
by Holger Prause
Hello,
i have a site where the uses can select TaskItems (entities from the database)
and set it to a task.
I use a OneToMany relationship (a task hast many taskitems)
When i set the TaskItems to the task and save it, everything will be ok.
But when i save another task whith the same TaskItems, it will fail becourse the primary key of the temporary join table "task_taskItems"
is the foreign key to the task item, this means in my case when then taskitems were set to a task, no other other task can have these taskitems
So the question is:
How can i specify the primary key of the temporary table?
As Workaround i could write a Class which wraps around the TaskItems
and inside there i can use @JoinColumn but it will mess up my code :-/
| @OneToMany
| @JoinTable(
| name="task_taskItems",
| joinColumns = { @JoinColumn( name="task_id", unique = false), @JoinColumn( name="task_taskItems_id", unique = true) },
| inverseJoinColumns = @JoinColumn( name="taskItem_id", unique = false)
| )
| public List<TaskItem> getTaskItems() {
| return this.taskItems;
| }
| public void setTaskItems(List<TaskItem> taskItems) {
| this.taskItems = taskItems;
| }
|
Thank u very much,
Holger
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961443#3961443
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961443
19 years, 9 months
[EJB 3.0] - Re: Enum attributes in Entity Beans ...
by wcydaip
"dsouza" wrote : Ok, I tested it again for Oracle and it did work, however I did run into some other problems.
|
| SOME SECURITY
|
| I have a cactus test suite that inserts/updates/deletes entities in the database to make sure they're working and that they have the appropriate permissions. So in order to test the use of enums in an entity I used one of my entity tests (for an entity that needs an enum).
|
| Basically I have this line of code in my test suite:
|
| | interfaceMessage.setMessageType(InterfaceMessageType.WARNING);
| |
| where InterfaceMessageType is my enum. If I change the line to
|
| | interfaceMessage.setMessageType(InterfaceMessageType.ERROR);
| |
| and redeploy without restarting JBOSS, I get the following exception:
|
|
| | org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of entity.iface.InterfaceMessage.setMessageType
| | at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValuesWithOptimizer(PojoEntityTuplizer.java:209)
| | at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:179)
| | at org.hibernate.persister.entity.BasicEntityPersister.setPropertyValues(BasicEntityPersister.java:2981)
| | ...
| | Caused by: net.sf.cglib.beans.BulkBeanException: entity.enums.InterfaceMessageType
| | at entity.iface.InterfaceMessage$$BulkBeanByCGLIB$$48beb320.setPropertyValues(<generated>)
| | at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValuesWithOptimizer(PojoEntityTuplizer.java:206)
| | ... 84 more
| | Caused by: java.lang.ClassCastException: entity.enums.InterfaceMessageType
| | ... 86 more
| |
|
| If I restart JBOSS everything works fine (until I change the code again). I really have no idea why this is happening but I thought maybe something from mixing the latest hibernate cvs with the ejb 3 beta release, but then again I guess it's unlikely since hibernate handles the persistence. Any ideas of what might be causing this?
|
| Another problem is that the latest cvs broke some of my other code. Maybe it's something that's really changed for good and I'm not up to date yet, but I'm getting the following exception:
|
|
| | org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=brain/24, BranchQual=, localId=24] status=STATUS_NO_TRANSACTION; - nested throwable: (java.lang.ClassCastException: java.util.ArrayList)
| |
| | java.lang.RuntimeException: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=brain/24, BranchQual=, localId=24] status=STATUS_NO_TRANSACTION; - nested throwable: (java.lang.ClassCastException: java.util.ArrayList)
| | at org.jboss.aspects.tx.TxPolicy.handleEndTransactionException(TxPolicy.java:185)
| | at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:167)
| | at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:74)
| | ...
| |
|
| Looks like some problem in using ArrayList in OneToMany or ManyToMany relationships. Just thought you should know in case it's a new bug or something.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961438#3961438
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961438
19 years, 9 months
[Performance Tuning] - Re: JBoss Performance Tuning
by tdanecito
Hi Pramod,
Thanks for the comment. I am on vacation right now but checking this thread.
For what I can remember without my system in front of me for the server:
Windows 2000 professional sp4
Mustang 1.6 b91
JBoss 4.0.4 GA
Apache 2.2
Intel P4 3.0GHz HT Northwood core
Regular DDR 400
Two hard drives one for operating system and one for the apps and data
There are some details I have not mentioned because I would need more time and a separate web site to talk all about it. I have a regular job like the rest of you and this is just a long term fun project I can do but hope to release soon the entire system for everyone to use on the internet.
The client is experimental design so I am not talking about that till it is released.
Hope that helps.
-Tony Anecito
adanecito(a)yahoo.com
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961435#3961435
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961435
19 years, 9 months
[Tomcat, HTTPD, Servlets & JSP] - Serving dynamically generated JSPs
by mattgalvin
We have an appliacation that needs to dynamically generate JSPs and make them available for our customers to access. Can someone point me to how I can serve a jsp that is stored say in a database to an end user?
Right now, we've deployed our application as an exploded war (well, actually an exploded ear since ejbs are a part of the app). We use a servlet with an id parameter to reference the jsp that needs to be served. The servlet currently loads that jsp from the database and writes it to a temporary file on disk within the exploded war. It then redirects to that termporary jsp file.
For several reasons, we need to stop doing it this way. The basic reason is that we need to deploy our application as an archive, not exploded. As such, we can no longer write the temporary file. Any suggestions on how to serve this programmatically generated jsp without writing the file to disk first?
Thanks,
Matt
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961434#3961434
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961434
19 years, 9 months