[JBoss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Accessing the dicriminator column

2006-06-11 Thread rbenko
Yes, I actually figured out this rather simple (and obvious!) workaround just 
after I posted - thanks for the info.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3950305#3950305

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3950305


___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Accessing the dicriminator column

2006-06-09 Thread rbenko
I'm also looking for this functionality - anyone???

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3950194#3950194

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3950194


___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: Trouble persisting enum in SQL Server

2006-01-23 Thread rbenko
Never mind - I found that I have to change the SelectMode on the JDBC driver to 
"cursor".  For those who care, I found the answer here:

http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B313181


It's funny how you search all over the web for hours trying to figure it out, 
finally decide to post a question, and then find the answer 10 minutes later!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3919184#3919184

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3919184


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Trouble persisting enum in SQL Server

2006-01-23 Thread rbenko
Hello:

I'm getting a strange message when I try to persist an enum value in an entity 
- it seems my JDBC connection cannot determine the type of the column where the 
enum will be saved.  This is the message I get in the debug log:

DEBUG [org.hibernate.type.EnumType] Unable to guess the column type for enum 
through conn.getMetadata(): [Microsoft][SQLServer 2000 Driver for JDBC]Can't 
start a cloned connection while in manual transaction mode.

I'm not sure how to resolve this - Anyone else have this problem?  

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3919167#3919167

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3919167


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: Newly created identity not propagated to dependent colum

2006-01-22 Thread rbenko
Thanks for the reply.  I left out (access=AccessType.FIELD) in the @Entity 
annotation - I do use that.

I'll try and explain further - it seems that JBoss/Hibernate are generating the 
correct INSERT statements for the Entities, but it is not propagating the newly 
created Identity value for the WidgetHolder row to the Widget rows.  Using the 
trace, I see it is properly formatting the inserts, and even adding a "select 
scope_identity()" to the end of the insert statement to have SQL Server return 
the newly created ID - however, Hibernate is not using that value in the 
subsequent INSERT statement for the Widgets.  Very frustrating.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3918925#3918925

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3918925


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Newly created identity not propagated to dependent columns i

2006-01-21 Thread rbenko
Hello:

It seems like a simple problem, but I can't get it to work.  I have two 
entites, related by a OneToMany relationship:


  | @Entity
  | public class WidgetHolder {
  | 
  |@Id (generate=GeneratorType.IDENTITY)
  |private long id;
  | 
  | 
  |@OneToMany(mappedBy="myWidgetHolder", cascade=CascadeType.ALL)
  |private List myWidgets = new ArrayList();
  | 
  | 
  |public void addWidget(Widget aWidget) {
  |   myWidgets.add(aWidget);
  |}
  | }
  | 
  | 
  | @Entity
  | public class Widget {
  | 
  |...
  | 
  |@ManyToOne(optional=false)
  |@JoinColumn(name="WIDGET_HOLDER_ID", nullable=false, updatable=false)
  |private WidgetHolder myWidgetHolder;
  | 
  | 
  |public Widget(WidgetHolder aHolder) {
  |   myWidgetHolder = aHolder;
  |}
  | 
  | 
  |...
  | 
  | }
  | 

When I do the following in a SLSB:


  | public class StatelessBean {
  | 
  |@PersistenceContext (unitName="widgetContext")
  |protected EntityManager em;
  | 
  |public void createWidgetHolder() {
  | 
  |   WidgetHolder widgetHolder = new WidgetHolder();
  | 
  |   List widgets = new ArrayList();
  |   widgetHolder.addWidget(new Widget(widgetHolder))
  |   widgetHolder.addWidget(new Widget(widgetHolder));
  | 
  |   ...
  | 
  |   em.persist(widgetHolder);
  |}
  | }
  | 

I get the following error:

java.lang.RuntimeException: org.jboss.tm.JBossRollbackException: Unable to 
commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=VELOCITY1/39, 
BranchQual=, localId=39] status=STATUS_NO_TRANSACTION; - nested throwable: 
(org.hibernate.PropertyValueException: not-null property references a null or 
transient value: Widget.myWidgetHolder)

When I take out the "optional=false" and "nullable=false" on the ManyToOne 
relationship, the INSERT statement for Widget tries to insert a NULL in the 
WIDGET_HOLDER_ID column. (I use MSSQL 2000 as the datastore).

Is there some sort of annotation I need to explicitly tell Hibernate to get the 
newly-created ID from WidgetStore and use it in the INSERT of Widget?  Any help 
would be appreciated - thanks!!



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3918877#3918877

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3918877


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: Deleting an entity from another entity?

2005-12-13 Thread rbenko
Okay - more searching led to a 'workaround' using Hibernate's native 
CascadeTyp.DELETE_ORPHAN setting.  I'm not quite sure why a facility like this 
or like TopLink's 'Private Owned' flag is left out of the EJB spec - it seems 
like a fairly common mechanism.


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3912444#3912444

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3912444


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: Deleting an entity from another entity?

2005-12-13 Thread rbenko
Thanks for the reply.  Collection is already annotated with Cascade.REMOVE - 
merge() doesn't work in this instance.  I think I need a way to get to the 
EntityManager inside my Entity Bean.  For example:


  | @Entity
  | public class Container {
  |   private List items;
  | 
  |   @OneToMany(mappedBy="security", cascade=CascadeType.ALL)
  |   @MapKey (name="key")
  |   public MapgetProperties();
  | 
  |   ...
  | 
  |   public void removeProperty(String key) {
  | if (getProperties().containsKey(key)) {
  |   Object obj = getMyProperties().remove(key);
  |   //
  |   // This is where I think I could use the EntityManager 
  |   // to delete from database:
  |   //
  |   em.remove(obj);
  | }
  |   }
  | }
  | 

What is the best way to inject the EntityManager into an Entity Bean?  Or is 
there is another way to accomplish this without using the EntityManager?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3912350#3912350

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3912350


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Deleting an entity from another entity?

2005-12-12 Thread rbenko
This might be a stupid question, but I can't seem to find the answer to it.  
I'm fairly new to JBoss/Hibernate/EJB3.0, but I have a good deal of experience 
using TopLink.  I have a collection of entity objects contained in another 
entity object.  When I remove an entity from the collection (via a method on 
the owning entity) I would like to remove it from the datastore - how do I go 
about it?  Do I need to get a handle to the EntityManager and call remove()?  
If so, what is the best way to get a handle to the EntityManager inside an 
Entity Bean?

TopLink has a setting called 'Private Owned', which would automatically delete 
an object if you removed it from the owning entity's collection.  I see that 
Hibernate does this for simple collections (Strings and the like), but not for 
Entity collections.  Thanks for any help.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3912209#3912209

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3912209


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: GeneratorType.IDENTITY still causes attempt to insert ex

2005-12-12 Thread rbenko
Never mind - I set my hibernate dialect to SQLServerDialect, and it now works.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3912171#3912171

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3912171


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - GeneratorType.IDENTITY still causes attempt to insert explic

2005-12-12 Thread rbenko
Hello:

I'm using SQL Server 2000 with JBoss EJB 3.0.  For my identity column on a 
particular entity, I'm using GeneratorType.IDENTITY, which "should" let the DB 
insert a value into the identity column.  However The generated SQL is trying 
to insert an explicit value (null) in the identity column, which 
(understandably) causes a SQLServer error.  Is this a bug, or am I not using it 
properly?  Thanks for any help.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3912157#3912157

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3912157


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user