Hello, I am trying to save a SystemUser entity in JPA. I also want to save certain things like who created the SystemUser and who last modified the system User as well.
@ManyToOne(targetEntity = SystemUser.class)
@JoinColumn
private SystemUser userWhoCreated;
@Temporal(TemporalType.TIMESTAMP)
@DateTimeFormat(iso=ISO.DATE_TIME)
private Date timeCreated;
@ManyToOne(targetEntity = SystemUser.class)
@JoinColumn
private SystemUser userWhoLastModified;
@Temporal(TemporalType.TIMESTAMP)
@DateTimeFormat(iso=ISO.DATE_TIME)
private Date timeLastModified;
I also want to ensure that these values are not null when persisted. So If I use the NotNull JPA annotation, that is easily solved (along with reference to another entity)
The problem description is simple, I cannot save rootuser without having rootuser in the system if I am to use a DataLoader class to persist JPA entity. Every other later user can be easily persisted with userWhoModified as the "systemuser" , but systemuser it's self cannot be added in this scheme.
Is there a way so persist this first system user (I am thinking with SQL). This is a typical bootstrap (chicken or the egg) problem i suppose.
I have a table in data base which has column MonthNo ,Year ,MonthValue ,AvgYTD and it has values in
1 ROW... 1 , 2010 , 2.3 , 4.0 AND
2 ROW... 2, 2010, 3.3 ,5.0 AND
3 ROW.. 3, 2010, 3.3, 7.9
AND I want output in my SSRS.....
WHEN I SELECT MONTH MARCH USING PARAMETER THEN OUTPUT WILL BE....A TABLE AND IT HAS COLUMN
JAN , FEB , MARCH , AVGYTD and values in row are ..
2.3 ,3.3, 4.3, 7.9
thanks
I have two tables which get updated at almost the exact same time - I need to join on the datetime column.
I've tried this:
SELECT *
FROM A, B
WHERE ABS(DATEDIFF(second, A.Date_Time, B.Date_Time) = (
SELECT MIN(ABS(DATEDIFF(second, A.Date_Time, B2.Date_Time)))
FROM B AS B2
)
But it tells me:
Multiple columns are specified in an aggregated expression containing an outer reference. If an expression being aggregated contains an outer reference, then that outer reference must be the only column referenced in the expression.
How can I join these tables?
Hey guys,
In one of my pages, I use a Flex 4 app in a column on the left, and then normal HTML in a column to the right. Is there anyway I can make it so that the ratio between the two columns is the same no matter the resolution?
Thanks for reading.
For Eg...if the User needs to retrieve the 10th highest mark in a "mark" column.
The column may be in any order. I need Query for to get stud_name of 10th highest mark.
Say for eg..table name is student
columns are id, name, mark.
I screwed up and created a column as a varchar(255) where that is no longer sufficient. I've read that varchar has no performance benefits over text on Postgres, and so would like to convert the varchar to a text column in a safe way that preserves the data.
What's the best way for me to do this?
I have a spreadsheet (in Google Docs, but can be any spreadsheet) with a list of users (one per row), including a username (and other columns). Lets say there are 'n' rows.
I have another spreadsheet with less than 'n' rows. One column has a username, another column has some other piece of data (lets say car rego number). I want to move the car rego number to the corresponding user in the first spreadsheet.
How might I do this?
I need LastUpdatedDttm to be updated by SYSDATE whenever record is updated. But below annoataions do nt work as desired. SYSDATE is inserted only once and not updated for subsequent updations. Also, lastUpdDTTM is not part of sql generated by hibernate.
@Generated(GenerationTime.ALWAYS)
@Column(name="LAST_UPDATED_DTTM",insertable=false,updatable=true, columnDefinition ="timestamp default SYSDATE")
private Date lastUpdDTTM;
@Generated(GenerationTime.ALWAYS)
@Column(name="CREATED_DTTM", insertable=false, updatable=false)
private Date createdDTTM;
Hello,
I want to add a column to a gridview which contains button control. I am using ID(integer and primary key) as the 1st column of Gridview. What I want is that when a user clicks the button on any given row of gridview, I want to able to determine the ID of the row to which the clicked button belongs
Vam Yip
I have two SQLite tables, that I would love to join them on a name column. This column contains accented characters, so I am wondering how can I compare them for join. I would like the accents dropped for the comparison to work.
I have two models:
User
MentoringRelationship
MentoringRelationship is a join model that has a mentor_id column and a mentee_id column (both of these reference user_ids from the users table).
How can I specify a relation called 'mentees' on the User class that will return all of the users mentored by this user, using the MentoringRelationships join table? What relations do we need to declare in the User model and in the MentoringRelationship model?
Hi,
In a DataGridView, it is possible to set an individual DataGridViewCell like this:
dataGridView.Item(columnIndex, rowIndex) = New DataGridViewTextBoxCell.
However, is the new DataGridViewCell is set before his owning column become visible, it seems that the individual cell will be replaced (or marked?) by the column default cell.
Is there a way to fix this?
Regards,
Simon
Hi, lets say I have a script like that:
if(some condition)
begin
select somecolumn from sometable
end
Lets say, that "somecolumn" does not exist and the condition is not true, which means the select is NOT executed. Even though the select would not be executed, the script is not valid, Management Studio complains about the missing column "somecolumn".
Question: Can I somehow disable this sort of check so that the script is executed and since the if is not true, it will never notice that the column is missing?
Thanks :-)
Hi Guys,
Im trying to sort a column of data in a gtk tree view column non alphabetically. I cant seem to find a function in the GTK libraries that cant do such a thing
Does anyone here know of a way to do this?
Regards
Paul
I added a new entity to my model and it loads fine but no changes made in memory get persisted to disk. My values set on the car object work fine in memory but aren't getting persisted to disk on hitting the home button (in simulator). I am using almost exactly the same code on another entity in my application and its values persist to disk fine (core data - sqlite3); Does anyone have a clue what I'm overlooking here? Car is the managed object, cars in an NSMutableArray of car objects and Car is the entity and Visible is the attribute on the entity which I am trying to set.
Thanks for you assistance.
Scott
- (void)viewDidLoad {
myAppDelegate* appDelegate = (myAppDelegate*)[[UIApplication sharedApplication] delegate];
NSManagedObjectContext* managedObjectContex = appDelegate.managedObjectContext;
NSFetchRequest* request = [[NSFetchRequest alloc] init];
NSEntityDescription* entity = [NSEntityDescription entityForName:@"Car" inManagedObjectContext:managedObjectContex];
[request setEntity:entity];
NSSortDescriptor* sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"Name" ascending:YES];
NSArray* sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
[request setSortDescriptors:sortDescriptors];
[sortDescriptors release];
[sortDescriptor release];
NSError* error = nil;
cars = [[managedObjectContex executeFetchRequest:request error:&error] mutableCopy];
if (cars == nil) {
NSLog(@"Can't load the Cars data! Error: %@, %@", error, [error userInfo]);
}
[request release];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath {
Car* car = [cars objectAtIndex:indexPath.row];
if (car.Visible == [NSNumber numberWithBool:YES]) {
car.Visible = [NSNumber numberWithBool:NO];
[tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryNone;
}
else {
car.Visible = [NSNumber numberWithBool:YES];
[tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryCheckmark;
}
}
Can someone please write to me source code in Java? I have a task: create a program, that contains two dimensional array (with numbers) and the programm needs to sum zeros in each column and then get out the number of column in which the zeros are least.. thanks!
Hello, I have a column with pipe separated values such as:
'23|12.1| 450|30|9|78|82.5|92.1|120|185|52|11'
I want to parse this column to fill a table with 12 corresponding columns: month1, month2, month3...month12.
So month1 will have the value 23, month2 the value 12.1 etc...
Is there a way to parse it by a loop or delimeter instead of having to separate one value at a time using substr?
Thanks.
I am doing a select * on a postgresql table, and everything looks good. But if I do:
SELECT Name from People
It says:
ERROR: column People.Name does not exist
SQL state: 42703
Character: 8
But the name column shows up during select *. I've tried:
SELECT People.Name from People
as well, with the same result. Am I missing something? It should be pretty easy to do this in any other database.
I am trying to map an entity in NHibernate, that should have an Updated column. This should be the DateTime when the entity was last written to the database (either created or updated). I'd like NHibernate to control the update of the column, so I don't need to remember to set a property to the current time before updating.
Is there a built-in feature in NHibernate, that can handle this for me ?
Looking for any decent grid styles designer with standard features such as
select columns from a catalog
Change the ordering of columns
set column font/bold/italic etc.
set column styles - fixed left / right
etc.
Have done it before but don't have access to that code
Looking for any near ready to use sample before reinventing the wheel :)
preferably winforms but can use wpf too
hey guys
i made a script inspired by wordpress widgets'page to drag&drop blocks of my sites
but problem is in saving the position after droping
this is jquery code , i used to do the above target :
<script type="text/javascript" >$(function(){
$('.widget')
.each(function(){
$(this).hover(function(){
$(this).find('h4').addClass('collapse');
}, function(){
$(this).find('h4').removeClass('collapse');
})
.find('h4').hover(function(){
$(this).find('.in-widget-title').css('visibility', 'visible');
}, function(){
$(this).find('.in-widget-title').css('visibility', 'hidden');
})
.click(function(){
$(this).siblings('.widget-inside').toggle();
//Save state on change of collapse state of panel
updateWidgetData();
})
.end()
.find('.in-widget-title').css('visibility', 'hidden');
});
$('.column').sortable({
connectWith: '.column',
handle: 'h4',
cursor: 'move',
placeholder: 'placeholder',
forcePlaceholderSize: true,
opacity: 0.4,
start: function(event, ui){
//Firefox, Safari/Chrome fire click event after drag is complete, fix for that
if($.browser.mozilla || $.browser.safari)
$(ui.item).find('.widget-inside').toggle();
},
stop: function(event, ui){
ui.item.css({'top':'0','left':'0'}); //Opera fix
if(!$.browser.mozilla && !$.browser.safari)
updateWidgetData();
}
})
.disableSelection();
});
function updateWidgetData(){
var items=[];
$('.column').each(function(){
var columnId=$(this).attr('id');
$('.widget', this).each(function(i){
var collapsed=0;
if($(this).find('.widget-inside').css('display')=="none")
collapsed=1;
//Create Item object for current panel
var item={
id: $(this).attr('id'),
collapsed: collapsed,
order : i,
column: columnId
};
//Push item object into items array
items.push(item);
});
});
//Assign items array to sortorder JSON variable
var sortorder={ items: items };
//Pass sortorder variable to server using ajax to save state
$.post('updatePanels.php', 'data='+$.toJSON(sortorder), function(response){
if(response=="success")
$("#console").html('<div class="success">Saved</div>').hide().fadeIn(1000);
setTimeout(function(){
$('#console').fadeOut(1000);
}, 2000);
});
}
</script>
and a simple php file
but problem is its not sending data to target php file
is there anything wrong with my code ?
If I need to append data (not insert) into a particular super column, what should I do?
For eg:
Consider a existing record described below
Kespace : test
columFamily: testColum
SuperColumn : testSuper
column_name : email
value : [email protected]
Here if I want to add my phone number to the super column "testSuper". What should I do?
Currently i have sql-server nvarchar(max) column which has text that starts with
"""
The only thing that varies in the pattern is the < in the class name.
The common part is
""
Some sample values are
""
""
""
All the
These span text are present only at the beginning of the column. Any such matching span in the middle should not be removed or matched.
Whats the sql server query with regex to remove all these occurance of span?
class AddTitleToPosts < ActiveRecord::Migration
def self.up
add_column :posts, :title, :string
Post.find(:all).each do |post|
post.update(:title => post.name.upcase)
end
end
def self.down
end
end
Like you can nothing particularly complicated, just trying to add new column title by changing case of name column already in db. But I get attempt to call private method error. I'm guessing it has something to do with 'self'?
Thanks for your help.