Search Results

Search found 12215 results on 489 pages for 'identity column'.

Page 29/489 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • How to prevent Hibernate from nullifying relationship column during entity removal

    - by Grzegorz
    I have two entities, A and B. I need to easily retrieve entities A, joined with entities B on the condition of equal values of some column (some column from A equal to some column in B). Those columns are not primary or foreign keys, they contain same business data. I just need to have access from each instance of A to the collection of B's with the same value of this column. So I model it like this: class A { @OneToMany @JoinColumn(name="column_in_B", referencedColumnName="column_in_A") Collection<B> bs; This way, I can run queries like "select A join fetch a.bs b where b...." (Actually, the real relationship here is many-to-many. But when I use @ManyToMany, Hibernate forces me to use join table, which doesnt exist here. So I have to use @OneToMany as workaround). So far so good. The main problem is: whenever I delete an instance of A, hibernate calls "Update B set column_in_B = null", becuase it thinks the column_in_B is foreign key pointing at primary key in A (and because row in A is deleted, it tries to clean the foreign key in B). BUT the column_in_B IS NOT a foreign key, and can't be modified, because it causes data lost (and this column is NOT NULL anyway in my case, causing data integerity exception to be thrown). Plese help me with this. How to model such relationships with Hibernate? (I would call it "virtual relationships", or "secondary relationships" or so: as they are not based on foreign keys, they are just some shortcuts which allows for retrieving related objects and quering for them with HQL)

    Read the article

  • How to change column width of a table

    - by vybhav
    For the following code, I am not able to set the column size to a custom size. Why is it so?Also the first column is not being displayed. import java.awt.BorderLayout; import java.awt.GridLayout; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTable; import javax.swing.table.TableColumn; public class Trial extends JFrame{ public void create(){ JPanel jp = new JPanel(); String[] string = {" ", "A"}; Object[][] data = {{"A", "0"},{"B", "3"},{"C","5"},{"D","-"}}; JTable table = new JTable(data, string); jp.setLayout(new GridLayout(2,0)); jp.add(table); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); TableColumn column = null; for (int i = 0; i < 2; i++) { column = table.getColumnModel().getColumn(i); column.setPreferredWidth(20); //custom size } setLayout(new BorderLayout()); add(jp); } public static void main(String [] a){ Trial trial = new Trial(); trial.setSize(300,300); trial.setVisible(true); trial.setDefaultCloseOperation(Trial.EXIT_ON_CLOSE); trial.create(); } }

    Read the article

  • VB.net Reading from ListViews with Multiple Columns

    - by xzerox
    Alright. So I was able to find out how to read from the first column but I need to read from both of them. I am using full row select which I need on there. Here is the code I am using to get it for the first column. Dim I As Integer For I = 0 To ListView1.SelectedItems.Count - 1 MsgBox(ListView1.SelectedItems(I).Text) Next MessageBox.Show(ListView1.Columns(0).Text)

    Read the article

  • How to split a single column values to multiple column values?

    - by Shahsra
    Hi All, I have a problem splitting single column values to multiple column values. For Example: **Name** abcd efgh ijk lmn opq asd j. asdjja asb (asdfas) asd asd and I need the output something like this: first_name last_name abcd efgh ijk opq asd asdjja asb asd asd null The middle name can be omitted (no need for a middle name) The columns are already created and need to insert the data from that single 'Name' column. Thanks a lot, Shahsra

    Read the article

  • Adding data (not only text) to a multi column ListView (WPF)

    - by user811804
    I am working on a WPF application in C# (.NET 4.0) where I have a ListView with a GridView that has two columns. I dynamically want to add rows (in code). My dilemma is that only the first column will have regular text added to it. The second column will have an object that includes a multi column Grid with TextBlocks. (see link http://imageshack.us/photo/my-images/803/listview.png/) If I do what you would normally do when you want to enter text in all columns (ie. DisplayMemberBinding) all I get in the second column is the text "System.Windows.Grid", which obviously isn't what I want. For reference if I just try to add the Grid object (with the TextBlocks) with the code listView1.Items.Add(grid1) (not using DisplayMemberBinding) the object gets added to the second column only (with the first column being blank) and not how it normally works with text where the same text ends up in all columns. I hope my question is detailed enough and any help with this would be much appreciated. EDIT: I have tried the following code, howeever every time I click the button to add a new row every single row gets updated with the same datatemplate. (ie. the second column always shows the same data on every row.) xaml: <Window x:Class="TEST.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="AAA" Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded"> <Grid Name="grid1"> <Grid.ColumnDefinitions> <ColumnDefinition Width="374*" /> <ColumnDefinition Width="129*" /> </Grid.ColumnDefinitions> <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="21,12,0,0" Name="button1" VerticalAlignment="Top" Width="75" Grid.Column="1" Click="button1_Click" /> </Grid> code: public partial class MainWindow : Window { ListView listView1 = new ListView(); GridViewColumn viewCol2 = new GridViewColumn(); public MainWindow() { InitializeComponent(); Style style = new Style(typeof(ListViewItem)); style.Setters.Add(new Setter(ListViewItem.HorizontalContentAlignmentProperty, HorizontalAlignment.Stretch)); listView1.ItemContainerStyle = style; GridView gridView1 = new GridView(); listView1.View = gridView1; GridViewColumn viewCol1 = new GridViewColumn(); viewCol1.Header = "Option"; gridView1.Columns.Add(viewCol1); viewCol2.Header = "Value"; gridView1.Columns.Add(viewCol2); grid1.Children.Add(listView1); viewCol1.DisplayMemberBinding = new Binding("Option"); } private void Window_Loaded(object sender, RoutedEventArgs e) { } private void button1_Click(object sender, RoutedEventArgs e) { DataTemplate dataTemplate = new DataTemplate(); FrameworkElementFactory spFactory = new FrameworkElementFactory(typeof(Grid)); Random random = new Random(); int cols = random.Next(1, 6); int full = 100; for (int i = 0; i < cols; i++) { FrameworkElementFactory col1 = new FrameworkElementFactory(typeof(ColumnDefinition)); int partWidth = random.Next(0, full); full -= partWidth; col1.SetValue(ColumnDefinition.WidthProperty, new GridLength(partWidth, GridUnitType.Star)); spFactory.AppendChild(col1); } if (full > 0) { FrameworkElementFactory col1 = new FrameworkElementFactory(typeof(ColumnDefinition)); col1.SetValue(ColumnDefinition.WidthProperty, new GridLength(full, GridUnitType.Star)); spFactory.AppendChild(col1); } for (int i = 0; i < cols; i++) { FrameworkElementFactory text1 = new FrameworkElementFactory(typeof(TextBlock)); SolidColorBrush sb1 = new SolidColorBrush(); switch (i) { case 0: sb1.Color = Colors.Blue; break; case 1: sb1.Color = Colors.Red; break; case 2: sb1.Color = Colors.Yellow; break; case 3: sb1.Color = Colors.Green; break; case 4: sb1.Color = Colors.Purple; break; case 5: sb1.Color = Colors.Pink; break; case 6: sb1.Color = Colors.Brown; break; } text1.SetValue(TextBlock.BackgroundProperty, sb1); text1.SetValue(Grid.ColumnProperty, i); spFactory.AppendChild(text1); } if (full > 0) { FrameworkElementFactory text1 = new FrameworkElementFactory(typeof(TextBlock)); SolidColorBrush sb1 = new SolidColorBrush(Colors.Black); text1.SetValue(TextBlock.BackgroundProperty, sb1); text1.SetValue(Grid.ColumnProperty, cols); spFactory.AppendChild(text1); } dataTemplate.VisualTree = spFactory; viewCol2.CellTemplate = dataTemplate; int rows = listView1.Items.Count + 1; listView1.Items.Add(new { Option = "Row " + rows }); } }

    Read the article

  • Numeric equivalent of an Excel column name

    - by Vivin Paliath
    The challenge The shortest code by character count that will output the numeric equivalent of an Excel column string. For example, the A column is 1, B is 2, so on and so forth. Once you hit Z, the next column becomes AA, then AB and so on. Test cases: A: 1 B: 2 AD: 30 ABC: 731 WTF: 16074 ROFL: 326676 Code count includes input/output (i.e full program).

    Read the article

  • Table/column names enclosed in square brackets, even though their names consist of legal characters

    - by AspOnMyNet
    Square brackets allow you to use names for columns or aliases that contain characters not permitted for column names or aliases. a) I’ve noticed that lots of times table and column names are enclosed inside square brackets, even though their names consist of perfectly legal characters. Why is that? b) As far as I know, square brackets enclosing object’s name aren’t actually a part of that name. Thus, if we create a table named [A]: CREATE TABLE [A] ( … ) we can later reference it without using brackets: SELECT * FROM A But why isn’t the same true when I try to reference a column KEY from a table returned by CONTAINSTABLE function? Namely, if I omit the brackets enclosing column name, I get an error: SELECT ct.KEY FROM CONTAINSTABLE(fullText,*,'some_string') as ct thanx

    Read the article

  • how to sort Gridview rows by a unbound Template column

    - by Nickson
    i want to sort my Gridview rows by a template column that is not bound to any database field. This template coulmn just has a label whose text i set in code depending on a value in a different column that is databound. So am stuck on how to set its sortExpression since its not linked to an column.

    Read the article

  • excel vba: return values only if they are not present in current column

    - by every_answer_gets_a_point
    i have a column to which i am adding data from another column i would like to check whether that column has the data that i wish to add. can you help me wiht a formula that will tell me whether a certain value exists in the current column? please keep in mind it is a bit more complex than it sounds. currently i have this in the cell: =IF(OR(A3="ETG_C",A3="ETGC"),C3,"na") i would like to have something like this =IF(FIND(IF(OR(A2="ETG_C",A2="ETGC"),C2,"na"),K:K,1)," ",IF(OR(A2="ETG_C",A2="ETGC"),C2,"na")) another words, if the top value exists already, then add a blank space

    Read the article

  • How to run an equation along whole column in excel vba

    - by Elad Sommer
    I want to run an excel vba which will go down column E and upon finding the value = "capa" will go two cell below, calculate the hex2dec value of that cell, present it by the cell with the value "capa" in column F and continue to search down column E. So far I've came with the below but it doesn't work: For Each cell In Range("E:E") If cell.Value = "Capa" Then ActiveCell.Offset.FormulaR1C1 = "=HEX2DEC(R[2]C[-1])" End If Next cell Thanks!

    Read the article

  • Disable column resizing in <rich:extendedDataTable>

    - by Sukanya
    Hi, I am using rich:extendedDataTable to display a table. But i need to disable the column resizing in this table. I have tried using width component in rich:column but i am getting the same thing. Even I have used css class to fix the column size that is also nnot worth. Can any one help me to find a way out............Its urgent !!

    Read the article

  • JPA joined column allow every value...

    - by Fabio Beoni
    I'm testing JPA, in a simple case File/FileVersions tables (Master/Details), with OneToMany relation, I have this problem: in FileVersions table, the field "file_id" (responsable for the relation with File table) accepts every values, not only values from File table. How can I use the JPA mapping to limit the input in FileVersion.file_id only for values existing in File.id? My class are File and FileVersion: FILE CLASS @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="FILE_ID") private Long id; @Column(name="NAME", nullable = false, length = 30) private String name; //RELATIONS ------------------------------------------- @OneToMany(mappedBy="file", fetch=FetchType.EAGER) private Collection <FileVersion> fileVersionsList; //----------------------------------------------------- FILEVERSION CLASS @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="VERSION_ID") private Long id; @Column(name="FILENAME", nullable = false, length = 255) private String fileName; @Column(name="NOTES", nullable = false, length = 200) private String notes; //RELATIONS ------------------------------------------- @ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name="FILE_ID", referencedColumnName="FILE_ID", nullable=false) private File file; //----------------------------------------------------- and this is the FILEVERSION TABLE CREATE TABLE `JPA-Support`.`FILEVERSION` ( `VERSION_ID` bigint(20) NOT NULL AUTO_INCREMENT, `FILENAME` varchar(255) NOT NULL, `NOTES` varchar(200) NOT NULL, `FILE_ID` bigint(20) NOT NULL, PRIMARY KEY (`VERSION_ID`), KEY `FK_FILEVERSION_FILE_ID` (`FILE_ID`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1

    Read the article

  • How to change SRID of geometry column?

    - by Z77
    I have table where the one of columns is geometry column the_geom for polygons with SRID. I added new column in the same table with exactly the same geometry data as in the_geom. This another column has name the_geom4258 because I want here to set up another SRID=4258. So what is the procedure to set up another SRID geometry to be changed (in another coord.system)? Is just enough to apply following query: UPDATE table SET the_geom4258=ST_SetSRID(the_geom4258,4258);

    Read the article

  • How to convert a table column to another data type

    - by holden
    I have a column with the type of Varchar in my Postgres database which I meant to be integers... and now I want to change them, unfortunately this doesn't seem to work using my rails migration. change_column :table1, :columnB, :integer So I tried doing this: execute 'ALTER TABLE "table1" ALTER COLUMN "columnB" TYPE integer USING CAST(columnB AS INTEGER)' but cast doesn't work in this instance because some of the column are null... any ideas?

    Read the article

  • How to get the Perticluar column value using jquery

    - by rockers
    I used this code to get the perticular column value using jquery.. $("#Grid td:first-child").click(function() { var resultArray = $(this).closest('tr').find('td').text(); alert(resultArray); }); How to get the peticular column value? that is I need grid 4th and 5th column value? thanks

    Read the article

  • Best way to dynamically get column names from oracle tables

    - by MNC
    Hi, We are using an extractor application that will export data from the database to csv files. Based on some condition variable it extracts data from different tables, and for some conditions we have to use UNION ALL as the data has to be extracted from more than one table. So to satisfy the UNION ALL condition we are using nulls to match the number of columns. Right now all the queries in the system are pre-built based on the condition variable. The problem is whenever there is change in the table projection (i.e new column added, existing column modified, column dropped) we have to manually change the code in the application. Can you please give some suggestions how to extract the column names dynamically so that any changes in the table structure do not require change in the code? My concern is the condition that decides which table to query. The variable condition is like if the condition is A, then load from TableX if the condition is B then load from TableA and TableY. We must know from which table we need to get data. Once we know the table it is straightforward to query the column names from the data dictionary. But there is one more condition, which is that some columns need to be excluded, and these columns are different for each table. I am trying to solve the problem only for dynamically generating the list columns. But my manager told me to make solution on the conceptual level rather than just fixing. This is a very big system with providers and consumers constantly loading and consuming data. So he wanted solution that can be general. So what is the best way for storing condition, tablename, excluded columns? One way is storing in database. Are there any other ways? If yes what is the best? As I have to give at least a couple of ideas before finalizing. Thanks,

    Read the article

  • Cassandra performance slow down with counter column

    - by tubcvt
    I have a cluster (4 node ) and a node have 16 core and 24 gb ram: 192.168.23.114 datacenter1 rack1 Up Normal 44.48 GB 25.00% 192.168.23.115 datacenter1 rack1 Up Normal 44.51 GB 25.00% 192.168.23.116 datacenter1 rack1 Up Normal 44.51 GB 25.00% 192.168.23.117 datacenter1 rack1 Up Normal 44.51 GB 25.00% We use about 10 column family (counter column) to make some system statistic report. Problem on here is that When i set replication_factor of this keyspace from 1 to 2 (contain 10 counter column family ), all cpu of node increase from 10% ( when use replication factor=1) to --- 90%. :( :( who can help me work around that :( . why counter column consume too much cpu time :(. thanks all

    Read the article

  • CSS Multi-Column Forms in HTML/ASP.NET

    - by Caveatrob
    I've researched for hours and still haven't found a robust, non-absolute-positioning solution for displaying multiple-column forms and values without using TABLE tags. Can someone point me to a resource specifically oriented towards reproducing table-based, multiple-column forms (like name and address forms) in CSS to standards? Most of the forms I see only have a single column with field/value.

    Read the article

  • The name/identity of the invoker of a web service

    - by Swamy g
    I have a SOAP web service which I call from two clients using axis2. Can the web service know from which of these two clients the call originated from? If so, how do I know that during runtime? Is there any API provided to lookup the name of the invoker of a particular web service by that web service. Thanks.

    Read the article

  • How to find if dataTable contains column which name starts with abc

    - by VilemRousi
    In my program I have a dataTable and I´d like to know if is there a column which name starts with abc. For example I have a DataTable and its name is abcdef. I like to find this column using something like this: DataTable.Columns.Constains(ColumnName.StartWith(abc)) Because I know only part of the column name, I cannot use a Contains method. Is there any simple way how to do that? Thanks a lot.

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >