-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: How to get column names with in the app.
PostPosted: Fri Jun 11, 2004 12:48 pm 
Beginner
Beginner

Joined: Mon Feb 23, 2004 5:11 pm
Posts: 39
In my cuurnet project, I have a need to log information whenever a column is updated (for auditing purposes). So for a given object and a property, I need to log the TableName, ColumnName, OldValue, NewValue.

I am experimenting with the MetaData API and EntityPersister class to get the Table Name and ColumnName. While I could easily get the TableName using EntityPersister.getTableName(), the EnityPersister.getProperyColumnNames(int i) gives the alias names of the column and not the actual column. I see another method getActualPropertyColumnNames() that may do the job, but it is a protected method. What should I do to get the Column Name of a given property?

Also, is a there a commonly used way or a pattern to capture the new and old value and log it (or even persist it in some kind of audit table)?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 12, 2004 5:05 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
It is important for me, too
Can I get table name,column name, column properties (java type, database type, length, not null etc) from persistent class and mapping ?

regards
Haris Peco


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 13, 2004 9:57 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ClassMetaData and Configuration has this kind of info

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 15, 2004 8:29 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
How I can get instance Configuration class with spring ?
(spring's HiberanteDaoSupport have protected sessionFactory too, but I can
create new method for SessionFactory and then getClassMetadata)

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 16, 2004 3:06 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
I find Configuration in spring (ctx.getBean("&sessionFactory") ), but I want
database properties from DatabaseMetadata (special decimal and precision for number field) - Can I get it from hibernate ?

regards


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 17, 2004 2:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if you want DatabaseMetaData then fetch it from session.connection()

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.