You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "ncanis (JIRA)" <ji...@apache.org> on 2011/01/21 09:03:47 UTC

[jira] Created: (HBASE-3461) Hbase jdo module.

Hbase jdo module.
-----------------

                 Key: HBASE-3461
                 URL: https://issues.apache.org/jira/browse/HBASE-3461
             Project: HBase
          Issue Type: Improvement
    Affects Versions: 0.90.0
            Reporter: ncanis
             Fix For: 0.90.1


Hello.
first of all, thanks to hbase members so mush ,
you helped me a lot.

I wrote simple jdo module for hbase newbie. I wish this module can help them.

Some features
- simple jdo
- HTable pool ( I already know HTablePool in habse )
- simple query classes ( insert,delete,update,select)
- some convinent mehtods.
- table sequence generator

I want to contribute this module to hbase
absolutely, I'll do upgrade that more than more.

again, thanks for help.

[http://code.google.com/p/hbase-jdo/]
---------------------------------------------
{code} 

AbstractHBaseDBO dbo = new HBaseDBOImpl();
		
		//drop if table is already exist.
		if(dbo.isTableExist("user")){
			dbo.deleteTable("user");
		}
		
		//create table
		dbo.createTableIfNotExist("user",HBaseOrder.DESC,"account");
		//dbo.createTableIfNotExist("user",HBaseOrder.ASC,"account");
		
		//create index.
		String[] cols={"id","name"};
		dbo.addIndexExistingTable("user","account",cols);
		
		//insert
		InsertQuery insert = dbo.createInsertQuery("user");
		UserBean bean = new UserBean();
		bean.setFamily("account");
		bean.setAge(20);
		bean.setEmail("ncanis@gmail.com");
		bean.setId("ncanis");
		bean.setName("ncanis");
		bean.setPassword("1111");
		insert.insert(bean);
		
		//select 1 row
		SelectQuery select = dbo.createSelectQuery("user");
		UserBean resultBean = (UserBean)select.select(bean.getRow(),UserBean.class);
		
		// select column value.
		String value = (String)select.selectColumn(bean.getRow(),"account","id",String.class);
		
		// search with option (QSearch has EQUAL, NOT_EQUAL, LIKE)
		// select id,password,name,email from account where id='ncanis' limit startRow,20
		HBaseParam param = new HBaseParam();
		param.setPage(bean.getRow(),20);
		param.addColumn("id","password","name","email");
		param.addSearchOption("id","ncanis",QSearch.EQUAL);
		select.search("account", param, UserBean.class);
		
		// search column value is existing.
		boolean isExist = select.existColumnValue("account","id","ncanis".getBytes());
		
		// update password.
		UpdateQuery update = dbo.createUpdateQuery("user");
		Hashtable<String, byte[]> colsTable = new Hashtable<String, byte[]>();
		colsTable.put("password","2222".getBytes());
		update.update(bean.getRow(),"account",colsTable);
		
		//delete
		DeleteQuery delete = dbo.createDeleteQuery("user");
		delete.deleteRow(resultBean.getRow());
	
		////////////////////////////////////
		// etc
		
		// HTable pool with apache commons pool
		// borrow and release. HBasePoolManager(maxActive, minIdle etc..)
		IndexedTable table = dbo.getPool().borrow("user");
		dbo.getPool().release(table);
		
		// upload bigFile by hadoop directly.
		HBaseBigFile bigFile = new HBaseBigFile();
		File file = new File("doc/movie.avi");
		FileInputStream fis = new FileInputStream(file);
		Path rootPath = new Path("/files/");
		String filename = "movie.avi";
		bigFile.uploadFile(rootPath,filename,fis,true);
		
		// receive file stream from hadoop.
		Path p = new Path(rootPath,filename);
		InputStream is = bigFile.path2Stream(p,4096);

{code} 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HBASE-3461) Hbase jdo module.

Posted by "ncanis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-3461?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ncanis updated HBASE-3461:
--------------------------

    Attachment: hbase-jdo-src-0.1-20100121.jar
                hbase-jdo-examples-test-0.1-20100121.jar
                hbase-jdo-src-0.1-20100121.jar

This is sources.

> Hbase jdo module.
> -----------------
>
>                 Key: HBASE-3461
>                 URL: https://issues.apache.org/jira/browse/HBASE-3461
>             Project: HBase
>          Issue Type: Improvement
>    Affects Versions: 0.90.0
>            Reporter: ncanis
>             Fix For: 0.90.1
>
>         Attachments: hbase-jdo-examples-test-0.1-20100121.jar, hbase-jdo-src-0.1-20100121.jar
>
>
> Hello.
> first of all, thanks to hbase members so mush ,
> you helped me a lot.
> I wrote simple jdo module for hbase newbie. I wish this module can help them.
> Some features
> - simple jdo
> - HTable pool ( I already know HTablePool in habse )
> - simple query classes ( insert,delete,update,select)
> - some convinent mehtods.
> - table sequence generator
> I want to contribute this module to hbase
> absolutely, I'll do upgrade that more than more.
> again, thanks for help.
> [http://code.google.com/p/hbase-jdo/]
> ---------------------------------------------
> {code} 
> AbstractHBaseDBO dbo = new HBaseDBOImpl();
> 		
> 		//drop if table is already exist.
> 		if(dbo.isTableExist("user")){
> 			dbo.deleteTable("user");
> 		}
> 		
> 		//create table
> 		dbo.createTableIfNotExist("user",HBaseOrder.DESC,"account");
> 		//dbo.createTableIfNotExist("user",HBaseOrder.ASC,"account");
> 		
> 		//create index.
> 		String[] cols={"id","name"};
> 		dbo.addIndexExistingTable("user","account",cols);
> 		
> 		//insert
> 		InsertQuery insert = dbo.createInsertQuery("user");
> 		UserBean bean = new UserBean();
> 		bean.setFamily("account");
> 		bean.setAge(20);
> 		bean.setEmail("ncanis@gmail.com");
> 		bean.setId("ncanis");
> 		bean.setName("ncanis");
> 		bean.setPassword("1111");
> 		insert.insert(bean);
> 		
> 		//select 1 row
> 		SelectQuery select = dbo.createSelectQuery("user");
> 		UserBean resultBean = (UserBean)select.select(bean.getRow(),UserBean.class);
> 		
> 		// select column value.
> 		String value = (String)select.selectColumn(bean.getRow(),"account","id",String.class);
> 		
> 		// search with option (QSearch has EQUAL, NOT_EQUAL, LIKE)
> 		// select id,password,name,email from account where id='ncanis' limit startRow,20
> 		HBaseParam param = new HBaseParam();
> 		param.setPage(bean.getRow(),20);
> 		param.addColumn("id","password","name","email");
> 		param.addSearchOption("id","ncanis",QSearch.EQUAL);
> 		select.search("account", param, UserBean.class);
> 		
> 		// search column value is existing.
> 		boolean isExist = select.existColumnValue("account","id","ncanis".getBytes());
> 		
> 		// update password.
> 		UpdateQuery update = dbo.createUpdateQuery("user");
> 		Hashtable<String, byte[]> colsTable = new Hashtable<String, byte[]>();
> 		colsTable.put("password","2222".getBytes());
> 		update.update(bean.getRow(),"account",colsTable);
> 		
> 		//delete
> 		DeleteQuery delete = dbo.createDeleteQuery("user");
> 		delete.deleteRow(resultBean.getRow());
> 	
> 		////////////////////////////////////
> 		// etc
> 		
> 		// HTable pool with apache commons pool
> 		// borrow and release. HBasePoolManager(maxActive, minIdle etc..)
> 		IndexedTable table = dbo.getPool().borrow("user");
> 		dbo.getPool().release(table);
> 		
> 		// upload bigFile by hadoop directly.
> 		HBaseBigFile bigFile = new HBaseBigFile();
> 		File file = new File("doc/movie.avi");
> 		FileInputStream fis = new FileInputStream(file);
> 		Path rootPath = new Path("/files/");
> 		String filename = "movie.avi";
> 		bigFile.uploadFile(rootPath,filename,fis,true);
> 		
> 		// receive file stream from hadoop.
> 		Path p = new Path(rootPath,filename);
> 		InputStream is = bigFile.path2Stream(p,4096);
> {code} 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HBASE-3461) Hbase jdo module.

Posted by "ncanis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-3461?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ncanis updated HBASE-3461:
--------------------------

    Attachment:     (was: hbase-jdo-src-0.1-20100121.jar)

> Hbase jdo module.
> -----------------
>
>                 Key: HBASE-3461
>                 URL: https://issues.apache.org/jira/browse/HBASE-3461
>             Project: HBase
>          Issue Type: Improvement
>    Affects Versions: 0.90.0
>            Reporter: ncanis
>             Fix For: 0.90.1
>
>         Attachments: hbase-jdo-examples-test-0.1-20100121.jar, hbase-jdo-src-0.1-20100121.jar
>
>
> Hello.
> first of all, thanks to hbase members so mush ,
> you helped me a lot.
> I wrote simple jdo module for hbase newbie. I wish this module can help them.
> Some features
> - simple jdo
> - HTable pool ( I already know HTablePool in habse )
> - simple query classes ( insert,delete,update,select)
> - some convinent mehtods.
> - table sequence generator
> I want to contribute this module to hbase
> absolutely, I'll do upgrade that more than more.
> again, thanks for help.
> [http://code.google.com/p/hbase-jdo/]
> ---------------------------------------------
> {code} 
> AbstractHBaseDBO dbo = new HBaseDBOImpl();
> 		
> 		//drop if table is already exist.
> 		if(dbo.isTableExist("user")){
> 			dbo.deleteTable("user");
> 		}
> 		
> 		//create table
> 		dbo.createTableIfNotExist("user",HBaseOrder.DESC,"account");
> 		//dbo.createTableIfNotExist("user",HBaseOrder.ASC,"account");
> 		
> 		//create index.
> 		String[] cols={"id","name"};
> 		dbo.addIndexExistingTable("user","account",cols);
> 		
> 		//insert
> 		InsertQuery insert = dbo.createInsertQuery("user");
> 		UserBean bean = new UserBean();
> 		bean.setFamily("account");
> 		bean.setAge(20);
> 		bean.setEmail("ncanis@gmail.com");
> 		bean.setId("ncanis");
> 		bean.setName("ncanis");
> 		bean.setPassword("1111");
> 		insert.insert(bean);
> 		
> 		//select 1 row
> 		SelectQuery select = dbo.createSelectQuery("user");
> 		UserBean resultBean = (UserBean)select.select(bean.getRow(),UserBean.class);
> 		
> 		// select column value.
> 		String value = (String)select.selectColumn(bean.getRow(),"account","id",String.class);
> 		
> 		// search with option (QSearch has EQUAL, NOT_EQUAL, LIKE)
> 		// select id,password,name,email from account where id='ncanis' limit startRow,20
> 		HBaseParam param = new HBaseParam();
> 		param.setPage(bean.getRow(),20);
> 		param.addColumn("id","password","name","email");
> 		param.addSearchOption("id","ncanis",QSearch.EQUAL);
> 		select.search("account", param, UserBean.class);
> 		
> 		// search column value is existing.
> 		boolean isExist = select.existColumnValue("account","id","ncanis".getBytes());
> 		
> 		// update password.
> 		UpdateQuery update = dbo.createUpdateQuery("user");
> 		Hashtable<String, byte[]> colsTable = new Hashtable<String, byte[]>();
> 		colsTable.put("password","2222".getBytes());
> 		update.update(bean.getRow(),"account",colsTable);
> 		
> 		//delete
> 		DeleteQuery delete = dbo.createDeleteQuery("user");
> 		delete.deleteRow(resultBean.getRow());
> 	
> 		////////////////////////////////////
> 		// etc
> 		
> 		// HTable pool with apache commons pool
> 		// borrow and release. HBasePoolManager(maxActive, minIdle etc..)
> 		IndexedTable table = dbo.getPool().borrow("user");
> 		dbo.getPool().release(table);
> 		
> 		// upload bigFile by hadoop directly.
> 		HBaseBigFile bigFile = new HBaseBigFile();
> 		File file = new File("doc/movie.avi");
> 		FileInputStream fis = new FileInputStream(file);
> 		Path rootPath = new Path("/files/");
> 		String filename = "movie.avi";
> 		bigFile.uploadFile(rootPath,filename,fis,true);
> 		
> 		// receive file stream from hadoop.
> 		Path p = new Path(rootPath,filename);
> 		InputStream is = bigFile.path2Stream(p,4096);
> {code} 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HBASE-3461) Hbase jdo module.

Posted by "ncanis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-3461?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ncanis updated HBASE-3461:
--------------------------

    Attachment: HBaseExample.java
                hbase-jdo-0.1-20100121.jar

> Hbase jdo module.
> -----------------
>
>                 Key: HBASE-3461
>                 URL: https://issues.apache.org/jira/browse/HBASE-3461
>             Project: HBase
>          Issue Type: Improvement
>    Affects Versions: 0.90.0
>            Reporter: ncanis
>             Fix For: 0.90.1
>
>         Attachments: hbase-jdo-0.1-20100121.jar, hbase-jdo-examples-test-0.1-20100121.jar, hbase-jdo-src-0.1-20100121.jar, HBaseExample.java
>
>
> Hello.
> first of all, thanks to hbase members so mush ,
> you helped me a lot.
> I wrote simple jdo module for hbase newbie. I wish this module can help them.
> Some features
> - simple jdo
> - HTable pool ( I already know HTablePool in habse )
> - simple query classes ( insert,delete,update,select)
> - some convinent mehtods.
> - table sequence generator
> I want to contribute this module to hbase
> absolutely, I'll do upgrade that more than more.
> again, thanks for help.
> [http://code.google.com/p/hbase-jdo/]
> ---------------------------------------------
> {code} 
> AbstractHBaseDBO dbo = new HBaseDBOImpl();
> 		
> 		//drop if table is already exist.
> 		if(dbo.isTableExist("user")){
> 			dbo.deleteTable("user");
> 		}
> 		
> 		//create table
> 		dbo.createTableIfNotExist("user",HBaseOrder.DESC,"account");
> 		//dbo.createTableIfNotExist("user",HBaseOrder.ASC,"account");
> 		
> 		//create index.
> 		String[] cols={"id","name"};
> 		dbo.addIndexExistingTable("user","account",cols);
> 		
> 		//insert
> 		InsertQuery insert = dbo.createInsertQuery("user");
> 		UserBean bean = new UserBean();
> 		bean.setFamily("account");
> 		bean.setAge(20);
> 		bean.setEmail("ncanis@gmail.com");
> 		bean.setId("ncanis");
> 		bean.setName("ncanis");
> 		bean.setPassword("1111");
> 		insert.insert(bean);
> 		
> 		//select 1 row
> 		SelectQuery select = dbo.createSelectQuery("user");
> 		UserBean resultBean = (UserBean)select.select(bean.getRow(),UserBean.class);
> 		
> 		// select column value.
> 		String value = (String)select.selectColumn(bean.getRow(),"account","id",String.class);
> 		
> 		// search with option (QSearch has EQUAL, NOT_EQUAL, LIKE)
> 		// select id,password,name,email from account where id='ncanis' limit startRow,20
> 		HBaseParam param = new HBaseParam();
> 		param.setPage(bean.getRow(),20);
> 		param.addColumn("id","password","name","email");
> 		param.addSearchOption("id","ncanis",QSearch.EQUAL);
> 		select.search("account", param, UserBean.class);
> 		
> 		// search column value is existing.
> 		boolean isExist = select.existColumnValue("account","id","ncanis".getBytes());
> 		
> 		// update password.
> 		UpdateQuery update = dbo.createUpdateQuery("user");
> 		Hashtable<String, byte[]> colsTable = new Hashtable<String, byte[]>();
> 		colsTable.put("password","2222".getBytes());
> 		update.update(bean.getRow(),"account",colsTable);
> 		
> 		//delete
> 		DeleteQuery delete = dbo.createDeleteQuery("user");
> 		delete.deleteRow(resultBean.getRow());
> 	
> 		////////////////////////////////////
> 		// etc
> 		
> 		// HTable pool with apache commons pool
> 		// borrow and release. HBasePoolManager(maxActive, minIdle etc..)
> 		IndexedTable table = dbo.getPool().borrow("user");
> 		dbo.getPool().release(table);
> 		
> 		// upload bigFile by hadoop directly.
> 		HBaseBigFile bigFile = new HBaseBigFile();
> 		File file = new File("doc/movie.avi");
> 		FileInputStream fis = new FileInputStream(file);
> 		Path rootPath = new Path("/files/");
> 		String filename = "movie.avi";
> 		bigFile.uploadFile(rootPath,filename,fis,true);
> 		
> 		// receive file stream from hadoop.
> 		Path p = new Path(rootPath,filename);
> 		InputStream is = bigFile.path2Stream(p,4096);
> {code} 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HBASE-3461) Hbase jdo module.

Posted by "ncanis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-3461?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ncanis updated HBASE-3461:
--------------------------

    Description: 
Hello.
first of all, thanks to hbase members so much ,
you helped me a lot.

I wrote simple jdo module for hbase newbie. I wish this module can help them.

Some features
- simple jdo(used reflection)
- HTable pool ( I already know HTablePool in habse )
- simple query classes ( insert,delete,update,select)
- some convinent mehtods.
- table sequence generator

I want to contribute this module to hbase
absolutely, I'll do upgrade that more than more.

again, thanks for help.

[http://code.google.com/p/hbase-jdo/]
---------------------------------------------
{code} 

AbstractHBaseDBO dbo = new HBaseDBOImpl();
		
		//drop if table is already exist.
		if(dbo.isTableExist("user")){
			dbo.deleteTable("user");
		}
		
		//create table
		dbo.createTableIfNotExist("user",HBaseOrder.DESC,"account");
		//dbo.createTableIfNotExist("user",HBaseOrder.ASC,"account");
		
		//create index.
		String[] cols={"id","name"};
		dbo.addIndexExistingTable("user","account",cols);
		
		//insert
		InsertQuery insert = dbo.createInsertQuery("user");
		UserBean bean = new UserBean();
		bean.setFamily("account");
		bean.setAge(20);
		bean.setEmail("ncanis@gmail.com");
		bean.setId("ncanis");
		bean.setName("ncanis");
		bean.setPassword("1111");
		insert.insert(bean);
		
		//select 1 row
		SelectQuery select = dbo.createSelectQuery("user");
		UserBean resultBean = (UserBean)select.select(bean.getRow(),UserBean.class);
		
		// select column value.
		String value = (String)select.selectColumn(bean.getRow(),"account","id",String.class);
		
		// search with option (QSearch has EQUAL, NOT_EQUAL, LIKE)
		// select id,password,name,email from account where id='ncanis' limit startRow,20
		HBaseParam param = new HBaseParam();
		param.setPage(bean.getRow(),20);
		param.addColumn("id","password","name","email");
		param.addSearchOption("id","ncanis",QSearch.EQUAL);
		select.search("account", param, UserBean.class);
		
		// search column value is existing.
		boolean isExist = select.existColumnValue("account","id","ncanis".getBytes());
		
		// update password.
		UpdateQuery update = dbo.createUpdateQuery("user");
		Hashtable<String, byte[]> colsTable = new Hashtable<String, byte[]>();
		colsTable.put("password","2222".getBytes());
		update.update(bean.getRow(),"account",colsTable);
		
		//delete
		DeleteQuery delete = dbo.createDeleteQuery("user");
		delete.deleteRow(resultBean.getRow());
	
		////////////////////////////////////
		// etc
		
		// HTable pool with apache commons pool
		// borrow and release. HBasePoolManager(maxActive, minIdle etc..)
		IndexedTable table = dbo.getPool().borrow("user");
		dbo.getPool().release(table);
		
		// upload bigFile by hadoop directly.
		HBaseBigFile bigFile = new HBaseBigFile();
		File file = new File("doc/movie.avi");
		FileInputStream fis = new FileInputStream(file);
		Path rootPath = new Path("/files/");
		String filename = "movie.avi";
		bigFile.uploadFile(rootPath,filename,fis,true);
		
		// receive file stream from hadoop.
		Path p = new Path(rootPath,filename);
		InputStream is = bigFile.path2Stream(p,4096);

{code} 

  was:
Hello.
first of all, thanks to hbase members so mush ,
you helped me a lot.

I wrote simple jdo module for hbase newbie. I wish this module can help them.

Some features
- simple jdo
- HTable pool ( I already know HTablePool in habse )
- simple query classes ( insert,delete,update,select)
- some convinent mehtods.
- table sequence generator

I want to contribute this module to hbase
absolutely, I'll do upgrade that more than more.

again, thanks for help.

[http://code.google.com/p/hbase-jdo/]
---------------------------------------------
{code} 

AbstractHBaseDBO dbo = new HBaseDBOImpl();
		
		//drop if table is already exist.
		if(dbo.isTableExist("user")){
			dbo.deleteTable("user");
		}
		
		//create table
		dbo.createTableIfNotExist("user",HBaseOrder.DESC,"account");
		//dbo.createTableIfNotExist("user",HBaseOrder.ASC,"account");
		
		//create index.
		String[] cols={"id","name"};
		dbo.addIndexExistingTable("user","account",cols);
		
		//insert
		InsertQuery insert = dbo.createInsertQuery("user");
		UserBean bean = new UserBean();
		bean.setFamily("account");
		bean.setAge(20);
		bean.setEmail("ncanis@gmail.com");
		bean.setId("ncanis");
		bean.setName("ncanis");
		bean.setPassword("1111");
		insert.insert(bean);
		
		//select 1 row
		SelectQuery select = dbo.createSelectQuery("user");
		UserBean resultBean = (UserBean)select.select(bean.getRow(),UserBean.class);
		
		// select column value.
		String value = (String)select.selectColumn(bean.getRow(),"account","id",String.class);
		
		// search with option (QSearch has EQUAL, NOT_EQUAL, LIKE)
		// select id,password,name,email from account where id='ncanis' limit startRow,20
		HBaseParam param = new HBaseParam();
		param.setPage(bean.getRow(),20);
		param.addColumn("id","password","name","email");
		param.addSearchOption("id","ncanis",QSearch.EQUAL);
		select.search("account", param, UserBean.class);
		
		// search column value is existing.
		boolean isExist = select.existColumnValue("account","id","ncanis".getBytes());
		
		// update password.
		UpdateQuery update = dbo.createUpdateQuery("user");
		Hashtable<String, byte[]> colsTable = new Hashtable<String, byte[]>();
		colsTable.put("password","2222".getBytes());
		update.update(bean.getRow(),"account",colsTable);
		
		//delete
		DeleteQuery delete = dbo.createDeleteQuery("user");
		delete.deleteRow(resultBean.getRow());
	
		////////////////////////////////////
		// etc
		
		// HTable pool with apache commons pool
		// borrow and release. HBasePoolManager(maxActive, minIdle etc..)
		IndexedTable table = dbo.getPool().borrow("user");
		dbo.getPool().release(table);
		
		// upload bigFile by hadoop directly.
		HBaseBigFile bigFile = new HBaseBigFile();
		File file = new File("doc/movie.avi");
		FileInputStream fis = new FileInputStream(file);
		Path rootPath = new Path("/files/");
		String filename = "movie.avi";
		bigFile.uploadFile(rootPath,filename,fis,true);
		
		// receive file stream from hadoop.
		Path p = new Path(rootPath,filename);
		InputStream is = bigFile.path2Stream(p,4096);

{code} 


> Hbase jdo module.
> -----------------
>
>                 Key: HBASE-3461
>                 URL: https://issues.apache.org/jira/browse/HBASE-3461
>             Project: HBase
>          Issue Type: Improvement
>    Affects Versions: 0.90.0
>            Reporter: ncanis
>             Fix For: 0.90.1
>
>         Attachments: hbase-jdo-0.1-20100121.jar, hbase-jdo-examples-test-0.1-20100121.jar, hbase-jdo-src-0.1-20100121.jar, HBaseExample.java
>
>
> Hello.
> first of all, thanks to hbase members so much ,
> you helped me a lot.
> I wrote simple jdo module for hbase newbie. I wish this module can help them.
> Some features
> - simple jdo(used reflection)
> - HTable pool ( I already know HTablePool in habse )
> - simple query classes ( insert,delete,update,select)
> - some convinent mehtods.
> - table sequence generator
> I want to contribute this module to hbase
> absolutely, I'll do upgrade that more than more.
> again, thanks for help.
> [http://code.google.com/p/hbase-jdo/]
> ---------------------------------------------
> {code} 
> AbstractHBaseDBO dbo = new HBaseDBOImpl();
> 		
> 		//drop if table is already exist.
> 		if(dbo.isTableExist("user")){
> 			dbo.deleteTable("user");
> 		}
> 		
> 		//create table
> 		dbo.createTableIfNotExist("user",HBaseOrder.DESC,"account");
> 		//dbo.createTableIfNotExist("user",HBaseOrder.ASC,"account");
> 		
> 		//create index.
> 		String[] cols={"id","name"};
> 		dbo.addIndexExistingTable("user","account",cols);
> 		
> 		//insert
> 		InsertQuery insert = dbo.createInsertQuery("user");
> 		UserBean bean = new UserBean();
> 		bean.setFamily("account");
> 		bean.setAge(20);
> 		bean.setEmail("ncanis@gmail.com");
> 		bean.setId("ncanis");
> 		bean.setName("ncanis");
> 		bean.setPassword("1111");
> 		insert.insert(bean);
> 		
> 		//select 1 row
> 		SelectQuery select = dbo.createSelectQuery("user");
> 		UserBean resultBean = (UserBean)select.select(bean.getRow(),UserBean.class);
> 		
> 		// select column value.
> 		String value = (String)select.selectColumn(bean.getRow(),"account","id",String.class);
> 		
> 		// search with option (QSearch has EQUAL, NOT_EQUAL, LIKE)
> 		// select id,password,name,email from account where id='ncanis' limit startRow,20
> 		HBaseParam param = new HBaseParam();
> 		param.setPage(bean.getRow(),20);
> 		param.addColumn("id","password","name","email");
> 		param.addSearchOption("id","ncanis",QSearch.EQUAL);
> 		select.search("account", param, UserBean.class);
> 		
> 		// search column value is existing.
> 		boolean isExist = select.existColumnValue("account","id","ncanis".getBytes());
> 		
> 		// update password.
> 		UpdateQuery update = dbo.createUpdateQuery("user");
> 		Hashtable<String, byte[]> colsTable = new Hashtable<String, byte[]>();
> 		colsTable.put("password","2222".getBytes());
> 		update.update(bean.getRow(),"account",colsTable);
> 		
> 		//delete
> 		DeleteQuery delete = dbo.createDeleteQuery("user");
> 		delete.deleteRow(resultBean.getRow());
> 	
> 		////////////////////////////////////
> 		// etc
> 		
> 		// HTable pool with apache commons pool
> 		// borrow and release. HBasePoolManager(maxActive, minIdle etc..)
> 		IndexedTable table = dbo.getPool().borrow("user");
> 		dbo.getPool().release(table);
> 		
> 		// upload bigFile by hadoop directly.
> 		HBaseBigFile bigFile = new HBaseBigFile();
> 		File file = new File("doc/movie.avi");
> 		FileInputStream fis = new FileInputStream(file);
> 		Path rootPath = new Path("/files/");
> 		String filename = "movie.avi";
> 		bigFile.uploadFile(rootPath,filename,fis,true);
> 		
> 		// receive file stream from hadoop.
> 		Path p = new Path(rootPath,filename);
> 		InputStream is = bigFile.path2Stream(p,4096);
> {code} 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HBASE-3461) Hbase jdo module.

Posted by "stack (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-3461?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

stack updated HBASE-3461:
-------------------------

    Fix Version/s:     (was: 0.90.1)

Moving (nice) feature out of a bug fix-only release.

> Hbase jdo module.
> -----------------
>
>                 Key: HBASE-3461
>                 URL: https://issues.apache.org/jira/browse/HBASE-3461
>             Project: HBase
>          Issue Type: Improvement
>    Affects Versions: 0.90.0
>            Reporter: ncanis
>         Attachments: hbase-jdo-0.1-20100121.jar, hbase-jdo-examples-test-0.1-20100121.jar, hbase-jdo-src-0.1-20100121.jar, HBaseExample.java
>
>
> Hello.
> first of all, thanks to hbase members so much ,
> you helped me a lot.
> I wrote simple jdo module for hbase newbie. I wish this module can help them.
> Some features
> - simple jdo(used reflection)
> - HTable pool ( I already know HTablePool in habse )
> - simple query classes ( insert,delete,update,select)
> - some convinent mehtods.
> - table sequence generator
> I want to contribute this module to hbase
> absolutely, I'll do upgrade that more than more.
> again, thanks for help.
> [http://code.google.com/p/hbase-jdo/]
> ---------------------------------------------
> {code} 
> AbstractHBaseDBO dbo = new HBaseDBOImpl();
> 		
> 		//drop if table is already exist.
> 		if(dbo.isTableExist("user")){
> 			dbo.deleteTable("user");
> 		}
> 		
> 		//create table
> 		dbo.createTableIfNotExist("user",HBaseOrder.DESC,"account");
> 		//dbo.createTableIfNotExist("user",HBaseOrder.ASC,"account");
> 		
> 		//create index.
> 		String[] cols={"id","name"};
> 		dbo.addIndexExistingTable("user","account",cols);
> 		
> 		//insert
> 		InsertQuery insert = dbo.createInsertQuery("user");
> 		UserBean bean = new UserBean();
> 		bean.setFamily("account");
> 		bean.setAge(20);
> 		bean.setEmail("ncanis@gmail.com");
> 		bean.setId("ncanis");
> 		bean.setName("ncanis");
> 		bean.setPassword("1111");
> 		insert.insert(bean);
> 		
> 		//select 1 row
> 		SelectQuery select = dbo.createSelectQuery("user");
> 		UserBean resultBean = (UserBean)select.select(bean.getRow(),UserBean.class);
> 		
> 		// select column value.
> 		String value = (String)select.selectColumn(bean.getRow(),"account","id",String.class);
> 		
> 		// search with option (QSearch has EQUAL, NOT_EQUAL, LIKE)
> 		// select id,password,name,email from account where id='ncanis' limit startRow,20
> 		HBaseParam param = new HBaseParam();
> 		param.setPage(bean.getRow(),20);
> 		param.addColumn("id","password","name","email");
> 		param.addSearchOption("id","ncanis",QSearch.EQUAL);
> 		select.search("account", param, UserBean.class);
> 		
> 		// search column value is existing.
> 		boolean isExist = select.existColumnValue("account","id","ncanis".getBytes());
> 		
> 		// update password.
> 		UpdateQuery update = dbo.createUpdateQuery("user");
> 		Hashtable<String, byte[]> colsTable = new Hashtable<String, byte[]>();
> 		colsTable.put("password","2222".getBytes());
> 		update.update(bean.getRow(),"account",colsTable);
> 		
> 		//delete
> 		DeleteQuery delete = dbo.createDeleteQuery("user");
> 		delete.deleteRow(resultBean.getRow());
> 	
> 		////////////////////////////////////
> 		// etc
> 		
> 		// HTable pool with apache commons pool
> 		// borrow and release. HBasePoolManager(maxActive, minIdle etc..)
> 		IndexedTable table = dbo.getPool().borrow("user");
> 		dbo.getPool().release(table);
> 		
> 		// upload bigFile by hadoop directly.
> 		HBaseBigFile bigFile = new HBaseBigFile();
> 		File file = new File("doc/movie.avi");
> 		FileInputStream fis = new FileInputStream(file);
> 		Path rootPath = new Path("/files/");
> 		String filename = "movie.avi";
> 		bigFile.uploadFile(rootPath,filename,fis,true);
> 		
> 		// receive file stream from hadoop.
> 		Path p = new Path(rootPath,filename);
> 		InputStream is = bigFile.path2Stream(p,4096);
> {code} 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.